Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 31 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 34 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 36 | #define ALC880_FRONT_EVENT 0x01 |
| 37 | #define ALC880_DCVOL_EVENT 0x02 |
| 38 | #define ALC880_HP_EVENT 0x04 |
| 39 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* ALC880 board config type */ |
| 42 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | ALC880_3ST, |
| 44 | ALC880_3ST_DIG, |
| 45 | ALC880_5ST, |
| 46 | ALC880_5ST_DIG, |
| 47 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 48 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 49 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 50 | ALC880_6ST_DIG, |
| 51 | ALC880_F1734, |
| 52 | ALC880_ASUS, |
| 53 | ALC880_ASUS_DIG, |
| 54 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 55 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 56 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 58 | ALC880_UNIWILL, |
| 59 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 60 | ALC880_CLEVO, |
| 61 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 62 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 63 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 64 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_SND_DEBUG |
| 66 | ALC880_TEST, |
| 67 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 68 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 69 | ALC880_MODEL_LAST /* last tag */ |
| 70 | }; |
| 71 | |
| 72 | /* ALC260 models */ |
| 73 | enum { |
| 74 | ALC260_BASIC, |
| 75 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 76 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 77 | ALC260_HP_3013, |
| 78 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 79 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 80 | ALC260_WILL, |
| 81 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 82 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 83 | #ifdef CONFIG_SND_DEBUG |
| 84 | ALC260_TEST, |
| 85 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 87 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 90 | /* ALC262 models */ |
| 91 | enum { |
| 92 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 93 | ALC262_HIPPO, |
| 94 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 95 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 96 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 97 | ALC262_HP_BPC_D7000_WL, |
| 98 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 99 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 100 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 101 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 102 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 103 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 104 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 105 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 106 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 108 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 109 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 110 | ALC262_AUTO, |
| 111 | ALC262_MODEL_LAST /* last tag */ |
| 112 | }; |
| 113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | /* ALC268 models */ |
| 115 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 116 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 117 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 118 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 119 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 120 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 121 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 122 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 123 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 124 | #ifdef CONFIG_SND_DEBUG |
| 125 | ALC268_TEST, |
| 126 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 127 | ALC268_AUTO, |
| 128 | ALC268_MODEL_LAST /* last tag */ |
| 129 | }; |
| 130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | /* ALC269 models */ |
| 132 | enum { |
| 133 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 134 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 135 | ALC269_AMIC, |
| 136 | ALC269_DMIC, |
| 137 | ALC269VB_AMIC, |
| 138 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 139 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 140 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 141 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 142 | ALC269_AUTO, |
| 143 | ALC269_MODEL_LAST /* last tag */ |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC861 models */ |
| 147 | enum { |
| 148 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 149 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_3ST_DIG, |
| 151 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 152 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 153 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 154 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 155 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC861_AUTO, |
| 157 | ALC861_MODEL_LAST, |
| 158 | }; |
| 159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | /* ALC861-VD models */ |
| 161 | enum { |
| 162 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 163 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 164 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_3ST, |
| 166 | ALC861VD_3ST_DIG, |
| 167 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 168 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 170 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 171 | ALC861VD_AUTO, |
| 172 | ALC861VD_MODEL_LAST, |
| 173 | }; |
| 174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | /* ALC662 models */ |
| 176 | enum { |
| 177 | ALC662_3ST_2ch_DIG, |
| 178 | ALC662_3ST_6ch_DIG, |
| 179 | ALC662_3ST_6ch, |
| 180 | ALC662_5ST_DIG, |
| 181 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 183 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 184 | ALC663_ASUS_M51VA, |
| 185 | ALC663_ASUS_G71V, |
| 186 | ALC663_ASUS_H13, |
| 187 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 188 | ALC662_ECS, |
| 189 | ALC663_ASUS_MODE1, |
| 190 | ALC662_ASUS_MODE2, |
| 191 | ALC663_ASUS_MODE3, |
| 192 | ALC663_ASUS_MODE4, |
| 193 | ALC663_ASUS_MODE5, |
| 194 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 195 | ALC663_ASUS_MODE7, |
| 196 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 197 | ALC272_DELL, |
| 198 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 199 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 200 | ALC662_AUTO, |
| 201 | ALC662_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* ALC882 models */ |
| 205 | enum { |
| 206 | ALC882_3ST_DIG, |
| 207 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 208 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 209 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC882_TARGA, |
| 211 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 212 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 213 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 214 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 215 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 216 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 217 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 218 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 219 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | ALC883_3ST_2ch_DIG, |
| 221 | ALC883_3ST_6ch_DIG, |
| 222 | ALC883_3ST_6ch, |
| 223 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 224 | ALC883_TARGA_DIG, |
| 225 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 226 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 285 | struct alc_jack { |
| 286 | hda_nid_t nid; |
| 287 | int type; |
| 288 | struct snd_jack *jack; |
| 289 | }; |
| 290 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 291 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 292 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 293 | struct alc_customize_define { |
| 294 | unsigned int sku_cfg; |
| 295 | unsigned char port_connectivity; |
| 296 | unsigned char check_sum; |
| 297 | unsigned char customization; |
| 298 | unsigned char external_amp; |
| 299 | unsigned int enable_pcbeep:1; |
| 300 | unsigned int platform_type:1; |
| 301 | unsigned int swap:1; |
| 302 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 303 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 304 | }; |
| 305 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 306 | struct alc_fixup; |
| 307 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | struct alc_spec { |
| 309 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 310 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 312 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 313 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 315 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 316 | * don't forget NULL |
| 317 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 318 | */ |
| 319 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 321 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | struct hda_pcm_stream *stream_analog_playback; |
| 323 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 324 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 325 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 327 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | struct hda_pcm_stream *stream_digital_playback; |
| 329 | struct hda_pcm_stream *stream_digital_capture; |
| 330 | |
| 331 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 332 | struct hda_multi_out multiout; /* playback set-up |
| 333 | * max_channels, dacs must be set |
| 334 | * dig_out_nid and hp_nid are optional |
| 335 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 336 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 337 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 338 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | |
| 340 | /* capture */ |
| 341 | unsigned int num_adc_nids; |
| 342 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 343 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 344 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 346 | /* capture setup for dynamic dual-adc switch */ |
| 347 | unsigned int cur_adc_idx; |
| 348 | hda_nid_t cur_adc; |
| 349 | unsigned int cur_adc_stream_tag; |
| 350 | unsigned int cur_adc_format; |
| 351 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 353 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | const struct hda_input_mux *input_mux; |
| 355 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 356 | struct alc_mic_route ext_mic; |
| 357 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | |
| 359 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 360 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 362 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 363 | int const_channel_count; |
| 364 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | |
| 366 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 367 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 368 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 369 | /* jack detection */ |
| 370 | struct snd_array jacks; |
| 371 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 372 | /* dynamic controls, init_verbs and input_mux */ |
| 373 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 374 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 375 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 376 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 377 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 378 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 379 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 380 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 381 | /* hooks */ |
| 382 | void (*init_hook)(struct hda_codec *codec); |
| 383 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 384 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 385 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 386 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 387 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 388 | /* for pin sensing */ |
| 389 | unsigned int sense_updated: 1; |
| 390 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 391 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 392 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 393 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 394 | /* other flags */ |
| 395 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 396 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 397 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 398 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 399 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 400 | /* for virtual master */ |
| 401 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 402 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 403 | struct hda_loopback_check loopback; |
| 404 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 405 | |
| 406 | /* for PLL fix */ |
| 407 | hda_nid_t pll_nid; |
| 408 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 409 | |
| 410 | /* fix-up list */ |
| 411 | int fixup_id; |
| 412 | const struct alc_fixup *fixup_list; |
| 413 | const char *fixup_name; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 414 | }; |
| 415 | |
| 416 | /* |
| 417 | * configuration template - to be copied to the spec instance |
| 418 | */ |
| 419 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 420 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 421 | * with spec |
| 422 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 423 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 424 | const struct hda_verb *init_verbs[5]; |
| 425 | unsigned int num_dacs; |
| 426 | hda_nid_t *dac_nids; |
| 427 | hda_nid_t dig_out_nid; /* optional */ |
| 428 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 429 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 430 | unsigned int num_adc_nids; |
| 431 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 432 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 433 | hda_nid_t dig_in_nid; |
| 434 | unsigned int num_channel_mode; |
| 435 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 436 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 437 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 438 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 439 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 440 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 441 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 442 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 443 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 444 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 445 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 446 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | }; |
| 448 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | |
| 450 | /* |
| 451 | * input MUX handling |
| 452 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 453 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 454 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | { |
| 456 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 457 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 458 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 459 | if (mux_idx >= spec->num_mux_defs) |
| 460 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 461 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 462 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 463 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | } |
| 465 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 467 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | { |
| 469 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 470 | struct alc_spec *spec = codec->spec; |
| 471 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 472 | |
| 473 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 474 | return 0; |
| 475 | } |
| 476 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 477 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 478 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | { |
| 480 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 481 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 482 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 484 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 485 | hda_nid_t nid = spec->capsrc_nids ? |
| 486 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 487 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 489 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 490 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 491 | if (!imux->num_items && mux_idx > 0) |
| 492 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 493 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 494 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 495 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 496 | /* Matrix-mixer style (e.g. ALC882) */ |
| 497 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 498 | unsigned int i, idx; |
| 499 | |
| 500 | idx = ucontrol->value.enumerated.item[0]; |
| 501 | if (idx >= imux->num_items) |
| 502 | idx = imux->num_items - 1; |
| 503 | if (*cur_val == idx) |
| 504 | return 0; |
| 505 | for (i = 0; i < imux->num_items; i++) { |
| 506 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 507 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 508 | imux->items[i].index, |
| 509 | HDA_AMP_MUTE, v); |
| 510 | } |
| 511 | *cur_val = idx; |
| 512 | return 1; |
| 513 | } else { |
| 514 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 515 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 516 | &spec->cur_mux[adc_idx]); |
| 517 | } |
| 518 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 519 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 520 | /* |
| 521 | * channel mode setting |
| 522 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 523 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 524 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | { |
| 526 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 527 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 528 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 529 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 530 | } |
| 531 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 532 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 533 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | { |
| 535 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 536 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 537 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 538 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 539 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | } |
| 541 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 542 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 543 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | { |
| 545 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 546 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 547 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 548 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 549 | &spec->ext_channel_count); |
| 550 | if (err >= 0 && !spec->const_channel_count) { |
| 551 | spec->multiout.max_channels = spec->ext_channel_count; |
| 552 | if (spec->need_dac_fix) |
| 553 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 554 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 555 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | } |
| 557 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 558 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 559 | * 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] | 560 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 561 | * being part of a format specifier. Maximum allowed length of a value is |
| 562 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 563 | * |
| 564 | * Note: some retasking pin complexes seem to ignore requests for input |
| 565 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 566 | * are requested. Therefore order this list so that this behaviour will not |
| 567 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 568 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 569 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 570 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 571 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 572 | "Mic 50pc bias", "Mic 80pc bias", |
| 573 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 574 | }; |
| 575 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 576 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | }; |
| 578 | /* 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] | 579 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 580 | * addition, "input" pins may or may not process the mic bias option |
| 581 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 582 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 583 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 584 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 585 | #define ALC_PIN_DIR_IN 0x00 |
| 586 | #define ALC_PIN_DIR_OUT 0x01 |
| 587 | #define ALC_PIN_DIR_INOUT 0x02 |
| 588 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 589 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 590 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 591 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 592 | * For each direction the minimum and maximum values are given. |
| 593 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 594 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 595 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 596 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 597 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 598 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 599 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 600 | }; |
| 601 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 602 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 603 | #define alc_pin_mode_n_items(_dir) \ |
| 604 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 605 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 606 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 607 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 608 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 609 | unsigned int item_num = uinfo->value.enumerated.item; |
| 610 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 611 | |
| 612 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 613 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 614 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 615 | |
| 616 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 617 | item_num = alc_pin_mode_min(dir); |
| 618 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 619 | return 0; |
| 620 | } |
| 621 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 622 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 623 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 624 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 625 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 626 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 627 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 628 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 629 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 630 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 631 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 632 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 633 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 634 | /* Find enumerated value for current pinctl setting */ |
| 635 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 636 | 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] | 637 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 638 | *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] | 639 | return 0; |
| 640 | } |
| 641 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 642 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 643 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 644 | { |
| 645 | signed int change; |
| 646 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 647 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 648 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 649 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 650 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 651 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 652 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 653 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 654 | 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] | 655 | val = alc_pin_mode_min(dir); |
| 656 | |
| 657 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 658 | if (change) { |
| 659 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 660 | snd_hda_codec_write_cache(codec, nid, 0, |
| 661 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 662 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 663 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 664 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 665 | * for the requested pin mode. Enum values of 2 or less are |
| 666 | * input modes. |
| 667 | * |
| 668 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 669 | * reduces noise slightly (particularly on input) so we'll |
| 670 | * do it. However, having both input and output buffers |
| 671 | * enabled simultaneously doesn't seem to be problematic if |
| 672 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 673 | */ |
| 674 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 675 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 676 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 677 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 678 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 679 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 680 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 681 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 682 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 683 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 684 | } |
| 685 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 686 | return change; |
| 687 | } |
| 688 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 689 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 690 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 691 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 692 | .info = alc_pin_mode_info, \ |
| 693 | .get = alc_pin_mode_get, \ |
| 694 | .put = alc_pin_mode_put, \ |
| 695 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 696 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 697 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 698 | * together using a mask with more than one bit set. This control is |
| 699 | * currently used only by the ALC260 test model. At this stage they are not |
| 700 | * needed for any "production" models. |
| 701 | */ |
| 702 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 703 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 704 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 705 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 706 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 707 | { |
| 708 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 709 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 710 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 711 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 712 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 713 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 714 | |
| 715 | *valp = (val & mask) != 0; |
| 716 | return 0; |
| 717 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 718 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 719 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 720 | { |
| 721 | signed int change; |
| 722 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 723 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 724 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 725 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 726 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 727 | AC_VERB_GET_GPIO_DATA, |
| 728 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 729 | |
| 730 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 731 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 732 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 733 | gpio_data &= ~mask; |
| 734 | else |
| 735 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 736 | snd_hda_codec_write_cache(codec, nid, 0, |
| 737 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 738 | |
| 739 | return change; |
| 740 | } |
| 741 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 742 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 743 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 744 | .info = alc_gpio_data_info, \ |
| 745 | .get = alc_gpio_data_get, \ |
| 746 | .put = alc_gpio_data_put, \ |
| 747 | .private_value = nid | (mask<<16) } |
| 748 | #endif /* CONFIG_SND_DEBUG */ |
| 749 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 750 | /* A switch control to allow the enabling of the digital IO pins on the |
| 751 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 752 | * to provide something in the test model allowing digital outputs to be |
| 753 | * identified if present. If models are found which can utilise these |
| 754 | * outputs a more complete mixer control can be devised for those models if |
| 755 | * necessary. |
| 756 | */ |
| 757 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 758 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 759 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 760 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 761 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 762 | { |
| 763 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 764 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 765 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 766 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 767 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 768 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 769 | |
| 770 | *valp = (val & mask) != 0; |
| 771 | return 0; |
| 772 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 773 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 774 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 775 | { |
| 776 | signed int change; |
| 777 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 778 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 779 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 780 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 781 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 782 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 783 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 784 | |
| 785 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 786 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 787 | if (val==0) |
| 788 | ctrl_data &= ~mask; |
| 789 | else |
| 790 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 791 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 792 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 793 | |
| 794 | return change; |
| 795 | } |
| 796 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 797 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 798 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 799 | .info = alc_spdif_ctrl_info, \ |
| 800 | .get = alc_spdif_ctrl_get, \ |
| 801 | .put = alc_spdif_ctrl_put, \ |
| 802 | .private_value = nid | (mask<<16) } |
| 803 | #endif /* CONFIG_SND_DEBUG */ |
| 804 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 805 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 806 | * Again, this is only used in the ALC26x test models to help identify when |
| 807 | * the EAPD line must be asserted for features to work. |
| 808 | */ |
| 809 | #ifdef CONFIG_SND_DEBUG |
| 810 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 811 | |
| 812 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 813 | struct snd_ctl_elem_value *ucontrol) |
| 814 | { |
| 815 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 816 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 817 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 818 | long *valp = ucontrol->value.integer.value; |
| 819 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 820 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 821 | |
| 822 | *valp = (val & mask) != 0; |
| 823 | return 0; |
| 824 | } |
| 825 | |
| 826 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 827 | struct snd_ctl_elem_value *ucontrol) |
| 828 | { |
| 829 | int change; |
| 830 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 831 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 832 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 833 | long val = *ucontrol->value.integer.value; |
| 834 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 835 | AC_VERB_GET_EAPD_BTLENABLE, |
| 836 | 0x00); |
| 837 | |
| 838 | /* Set/unset the masked control bit(s) as needed */ |
| 839 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 840 | if (!val) |
| 841 | ctrl_data &= ~mask; |
| 842 | else |
| 843 | ctrl_data |= mask; |
| 844 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 845 | ctrl_data); |
| 846 | |
| 847 | return change; |
| 848 | } |
| 849 | |
| 850 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 851 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 852 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 853 | .info = alc_eapd_ctrl_info, \ |
| 854 | .get = alc_eapd_ctrl_get, \ |
| 855 | .put = alc_eapd_ctrl_put, \ |
| 856 | .private_value = nid | (mask<<16) } |
| 857 | #endif /* CONFIG_SND_DEBUG */ |
| 858 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 859 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 860 | * set up the input pin config (depending on the given auto-pin type) |
| 861 | */ |
| 862 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 863 | int auto_pin_type) |
| 864 | { |
| 865 | unsigned int val = PIN_IN; |
| 866 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 867 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 868 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 869 | unsigned int oldval; |
| 870 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 871 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 872 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 873 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 874 | /* if the default pin setup is vref50, we give it priority */ |
| 875 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 876 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 877 | else if (pincap & AC_PINCAP_VREF_50) |
| 878 | val = PIN_VREF50; |
| 879 | else if (pincap & AC_PINCAP_VREF_100) |
| 880 | val = PIN_VREF100; |
| 881 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 882 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 883 | } |
| 884 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 885 | } |
| 886 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 887 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 888 | { |
| 889 | struct alc_spec *spec = codec->spec; |
| 890 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 891 | |
| 892 | if (!cfg->line_outs) { |
| 893 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 894 | cfg->line_out_pins[cfg->line_outs]) |
| 895 | cfg->line_outs++; |
| 896 | } |
| 897 | if (!cfg->speaker_outs) { |
| 898 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 899 | cfg->speaker_pins[cfg->speaker_outs]) |
| 900 | cfg->speaker_outs++; |
| 901 | } |
| 902 | if (!cfg->hp_outs) { |
| 903 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 904 | cfg->hp_pins[cfg->hp_outs]) |
| 905 | cfg->hp_outs++; |
| 906 | } |
| 907 | } |
| 908 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 909 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 910 | */ |
| 911 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 912 | { |
| 913 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 914 | return; |
| 915 | spec->mixers[spec->num_mixers++] = mix; |
| 916 | } |
| 917 | |
| 918 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 919 | { |
| 920 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 921 | return; |
| 922 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 923 | } |
| 924 | |
| 925 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 926 | * set up from the preset table |
| 927 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 928 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 929 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 930 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 931 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 932 | int i; |
| 933 | |
| 934 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 935 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 936 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 937 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 938 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 939 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 940 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 941 | spec->channel_mode = preset->channel_mode; |
| 942 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 943 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 944 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 945 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 946 | if (preset->const_channel_count) |
| 947 | spec->multiout.max_channels = preset->const_channel_count; |
| 948 | else |
| 949 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 950 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 951 | |
| 952 | spec->multiout.num_dacs = preset->num_dacs; |
| 953 | spec->multiout.dac_nids = preset->dac_nids; |
| 954 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 955 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 956 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 957 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 958 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 959 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 960 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 961 | spec->input_mux = preset->input_mux; |
| 962 | |
| 963 | spec->num_adc_nids = preset->num_adc_nids; |
| 964 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 965 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 966 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 967 | |
| 968 | spec->unsol_event = preset->unsol_event; |
| 969 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 970 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 971 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 972 | spec->loopback.amplist = preset->loopbacks; |
| 973 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 974 | |
| 975 | if (preset->setup) |
| 976 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 977 | |
| 978 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 979 | } |
| 980 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 981 | /* Enable GPIO mask and set output */ |
| 982 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 983 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 984 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 985 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 986 | { } |
| 987 | }; |
| 988 | |
| 989 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 990 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 991 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 992 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 993 | { } |
| 994 | }; |
| 995 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 996 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 997 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 998 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 999 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 1000 | { } |
| 1001 | }; |
| 1002 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 1003 | /* |
| 1004 | * Fix hardware PLL issue |
| 1005 | * On some codecs, the analog PLL gating control must be off while |
| 1006 | * the default value is 1. |
| 1007 | */ |
| 1008 | static void alc_fix_pll(struct hda_codec *codec) |
| 1009 | { |
| 1010 | struct alc_spec *spec = codec->spec; |
| 1011 | unsigned int val; |
| 1012 | |
| 1013 | if (!spec->pll_nid) |
| 1014 | return; |
| 1015 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1016 | spec->pll_coef_idx); |
| 1017 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1018 | AC_VERB_GET_PROC_COEF, 0); |
| 1019 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1020 | spec->pll_coef_idx); |
| 1021 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1022 | val & ~(1 << spec->pll_coef_bit)); |
| 1023 | } |
| 1024 | |
| 1025 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1026 | unsigned int coef_idx, unsigned int coef_bit) |
| 1027 | { |
| 1028 | struct alc_spec *spec = codec->spec; |
| 1029 | spec->pll_nid = nid; |
| 1030 | spec->pll_coef_idx = coef_idx; |
| 1031 | spec->pll_coef_bit = coef_bit; |
| 1032 | alc_fix_pll(codec); |
| 1033 | } |
| 1034 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1035 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
| 1036 | static void alc_free_jack_priv(struct snd_jack *jack) |
| 1037 | { |
| 1038 | struct alc_jack *jacks = jack->private_data; |
| 1039 | jacks->nid = 0; |
| 1040 | jacks->jack = NULL; |
| 1041 | } |
| 1042 | |
| 1043 | static int alc_add_jack(struct hda_codec *codec, |
| 1044 | hda_nid_t nid, int type) |
| 1045 | { |
| 1046 | struct alc_spec *spec; |
| 1047 | struct alc_jack *jack; |
| 1048 | const char *name; |
| 1049 | int err; |
| 1050 | |
| 1051 | spec = codec->spec; |
| 1052 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
| 1053 | jack = snd_array_new(&spec->jacks); |
| 1054 | if (!jack) |
| 1055 | return -ENOMEM; |
| 1056 | |
| 1057 | jack->nid = nid; |
| 1058 | jack->type = type; |
| 1059 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; |
| 1060 | |
| 1061 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); |
| 1062 | if (err < 0) |
| 1063 | return err; |
| 1064 | jack->jack->private_data = jack; |
| 1065 | jack->jack->private_free = alc_free_jack_priv; |
| 1066 | return 0; |
| 1067 | } |
| 1068 | |
| 1069 | static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1070 | { |
| 1071 | struct alc_spec *spec = codec->spec; |
| 1072 | struct alc_jack *jacks = spec->jacks.list; |
| 1073 | |
| 1074 | if (jacks) { |
| 1075 | int i; |
| 1076 | for (i = 0; i < spec->jacks.used; i++) { |
| 1077 | if (jacks->nid == nid) { |
| 1078 | unsigned int present; |
| 1079 | present = snd_hda_jack_detect(codec, nid); |
| 1080 | |
| 1081 | present = (present) ? jacks->type : 0; |
| 1082 | |
| 1083 | snd_jack_report(jacks->jack, present); |
| 1084 | } |
| 1085 | jacks++; |
| 1086 | } |
| 1087 | } |
| 1088 | } |
| 1089 | |
| 1090 | static int alc_init_jacks(struct hda_codec *codec) |
| 1091 | { |
| 1092 | struct alc_spec *spec = codec->spec; |
| 1093 | int err; |
| 1094 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1095 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1096 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1097 | if (hp_nid) { |
| 1098 | err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE); |
| 1099 | if (err < 0) |
| 1100 | return err; |
| 1101 | alc_report_jack(codec, hp_nid); |
| 1102 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1103 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1104 | if (mic_nid) { |
| 1105 | err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE); |
| 1106 | if (err < 0) |
| 1107 | return err; |
| 1108 | alc_report_jack(codec, mic_nid); |
| 1109 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1110 | |
| 1111 | return 0; |
| 1112 | } |
| 1113 | #else |
| 1114 | static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1115 | { |
| 1116 | } |
| 1117 | |
| 1118 | static inline int alc_init_jacks(struct hda_codec *codec) |
| 1119 | { |
| 1120 | return 0; |
| 1121 | } |
| 1122 | #endif |
| 1123 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1124 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1125 | { |
| 1126 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1127 | unsigned int mute; |
| 1128 | hda_nid_t nid; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1129 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1130 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1131 | spec->jack_present = 0; |
| 1132 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1133 | nid = spec->autocfg.hp_pins[i]; |
| 1134 | if (!nid) |
| 1135 | break; |
| 1136 | if (snd_hda_jack_detect(codec, nid)) { |
| 1137 | spec->jack_present = 1; |
| 1138 | break; |
| 1139 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1140 | alc_report_jack(codec, spec->autocfg.hp_pins[i]); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1141 | } |
| 1142 | |
| 1143 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
| 1144 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1145 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1146 | nid = spec->autocfg.speaker_pins[i]; |
| 1147 | if (!nid) |
| 1148 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1149 | if (pinctl) { |
| 1150 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1151 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1152 | spec->jack_present ? 0 : PIN_OUT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1153 | } else { |
| 1154 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1155 | HDA_AMP_MUTE, mute); |
| 1156 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1157 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1158 | } |
| 1159 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1160 | static void alc_automute_pin(struct hda_codec *codec) |
| 1161 | { |
| 1162 | alc_automute_speaker(codec, 1); |
| 1163 | } |
| 1164 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1165 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1166 | hda_nid_t nid) |
| 1167 | { |
| 1168 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1169 | int i, nums; |
| 1170 | |
| 1171 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1172 | for (i = 0; i < nums; i++) |
| 1173 | if (conn[i] == nid) |
| 1174 | return i; |
| 1175 | return -1; |
| 1176 | } |
| 1177 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1178 | /* switch the current ADC according to the jack state */ |
| 1179 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1180 | { |
| 1181 | struct alc_spec *spec = codec->spec; |
| 1182 | unsigned int present; |
| 1183 | hda_nid_t new_adc; |
| 1184 | |
| 1185 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1186 | if (present) |
| 1187 | spec->cur_adc_idx = 1; |
| 1188 | else |
| 1189 | spec->cur_adc_idx = 0; |
| 1190 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1191 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1192 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1193 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1194 | spec->cur_adc = new_adc; |
| 1195 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1196 | spec->cur_adc_stream_tag, 0, |
| 1197 | spec->cur_adc_format); |
| 1198 | } |
| 1199 | } |
| 1200 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1201 | static void alc_mic_automute(struct hda_codec *codec) |
| 1202 | { |
| 1203 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1204 | struct alc_mic_route *dead, *alive; |
| 1205 | unsigned int present, type; |
| 1206 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1207 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1208 | if (!spec->auto_mic) |
| 1209 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1210 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1211 | return; |
| 1212 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1213 | return; |
| 1214 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1215 | if (spec->dual_adc_switch) { |
| 1216 | alc_dual_mic_adc_auto_switch(codec); |
| 1217 | return; |
| 1218 | } |
| 1219 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1220 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1221 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1222 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1223 | if (present) { |
| 1224 | alive = &spec->ext_mic; |
| 1225 | dead = &spec->int_mic; |
| 1226 | } else { |
| 1227 | alive = &spec->int_mic; |
| 1228 | dead = &spec->ext_mic; |
| 1229 | } |
| 1230 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1231 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1232 | if (type == AC_WID_AUD_MIX) { |
| 1233 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1234 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1235 | alive->mux_idx, |
| 1236 | HDA_AMP_MUTE, 0); |
| 1237 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1238 | dead->mux_idx, |
| 1239 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1240 | } else { |
| 1241 | /* MUX style (e.g. ALC880) */ |
| 1242 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1243 | AC_VERB_SET_CONNECT_SEL, |
| 1244 | alive->mux_idx); |
| 1245 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1246 | alc_report_jack(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1247 | |
| 1248 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1249 | } |
| 1250 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1251 | /* unsolicited event for HP jack sensing */ |
| 1252 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1253 | { |
| 1254 | if (codec->vendor_id == 0x10ec0880) |
| 1255 | res >>= 28; |
| 1256 | else |
| 1257 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1258 | switch (res) { |
| 1259 | case ALC880_HP_EVENT: |
| 1260 | alc_automute_pin(codec); |
| 1261 | break; |
| 1262 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1263 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1264 | break; |
| 1265 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1266 | } |
| 1267 | |
| 1268 | static void alc_inithook(struct hda_codec *codec) |
| 1269 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1270 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1271 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1272 | } |
| 1273 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1274 | /* additional initialization for ALC888 variants */ |
| 1275 | static void alc888_coef_init(struct hda_codec *codec) |
| 1276 | { |
| 1277 | unsigned int tmp; |
| 1278 | |
| 1279 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1280 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1281 | 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] | 1282 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1283 | /* alc888S-VC */ |
| 1284 | snd_hda_codec_read(codec, 0x20, 0, |
| 1285 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1286 | else |
| 1287 | /* alc888-VB */ |
| 1288 | snd_hda_codec_read(codec, 0x20, 0, |
| 1289 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1290 | } |
| 1291 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1292 | static void alc889_coef_init(struct hda_codec *codec) |
| 1293 | { |
| 1294 | unsigned int tmp; |
| 1295 | |
| 1296 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1297 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1298 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1299 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1300 | } |
| 1301 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1302 | /* turn on/off EAPD control (only if available) */ |
| 1303 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1304 | { |
| 1305 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1306 | return; |
| 1307 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1308 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1309 | on ? 2 : 0); |
| 1310 | } |
| 1311 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1312 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1313 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1314 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1315 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1316 | switch (type) { |
| 1317 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1318 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1319 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1320 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1321 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1322 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1323 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1324 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1325 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1326 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1327 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1328 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1329 | set_eapd(codec, 0x0f, 1); |
| 1330 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1331 | break; |
| 1332 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1333 | case 0x10ec0267: |
| 1334 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1335 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1336 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1337 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1338 | case 0x10ec0660: |
| 1339 | case 0x10ec0662: |
| 1340 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1341 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1342 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1343 | set_eapd(codec, 0x14, 1); |
| 1344 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1345 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1346 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1347 | switch (codec->vendor_id) { |
| 1348 | case 0x10ec0260: |
| 1349 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1350 | AC_VERB_SET_COEF_INDEX, 7); |
| 1351 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1352 | AC_VERB_GET_PROC_COEF, 0); |
| 1353 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1354 | AC_VERB_SET_COEF_INDEX, 7); |
| 1355 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1356 | AC_VERB_SET_PROC_COEF, |
| 1357 | tmp | 0x2010); |
| 1358 | break; |
| 1359 | case 0x10ec0262: |
| 1360 | case 0x10ec0880: |
| 1361 | case 0x10ec0882: |
| 1362 | case 0x10ec0883: |
| 1363 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1364 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1365 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1366 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1367 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1368 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1369 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1370 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1371 | #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] | 1372 | case 0x10ec0267: |
| 1373 | case 0x10ec0268: |
| 1374 | snd_hda_codec_write(codec, 0x20, 0, |
| 1375 | AC_VERB_SET_COEF_INDEX, 7); |
| 1376 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1377 | AC_VERB_GET_PROC_COEF, 0); |
| 1378 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1379 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1380 | snd_hda_codec_write(codec, 0x20, 0, |
| 1381 | AC_VERB_SET_PROC_COEF, |
| 1382 | tmp | 0x3000); |
| 1383 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1384 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1385 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1386 | break; |
| 1387 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1388 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1389 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1390 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1391 | { |
| 1392 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1393 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1394 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1395 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1396 | if (!cfg->hp_pins[0]) { |
| 1397 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1398 | return; |
| 1399 | } |
| 1400 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1401 | if (!cfg->speaker_pins[0]) { |
| 1402 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1403 | return; |
| 1404 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1405 | sizeof(cfg->speaker_pins)); |
| 1406 | cfg->speaker_outs = cfg->line_outs; |
| 1407 | } |
| 1408 | |
| 1409 | if (!cfg->hp_pins[0]) { |
| 1410 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1411 | sizeof(cfg->hp_pins)); |
| 1412 | cfg->hp_outs = cfg->line_outs; |
| 1413 | } |
| 1414 | |
| 1415 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1416 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1417 | cfg->hp_pins[i]); |
| 1418 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1419 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1420 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1421 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1422 | spec->unsol_event = alc_sku_unsol_event; |
| 1423 | } |
| 1424 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1425 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1426 | { |
| 1427 | struct alc_spec *spec = codec->spec; |
| 1428 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1429 | hda_nid_t fixed, ext; |
| 1430 | int i; |
| 1431 | |
| 1432 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1433 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1434 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1435 | return; |
| 1436 | |
| 1437 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1438 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1439 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1440 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1441 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1442 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1443 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1444 | if (fixed) |
| 1445 | return; /* already occupied */ |
| 1446 | fixed = nid; |
| 1447 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1448 | case INPUT_PIN_ATTR_UNUSED: |
| 1449 | return; /* invalid entry */ |
| 1450 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1451 | if (ext) |
| 1452 | return; /* already occupied */ |
| 1453 | ext = nid; |
| 1454 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1455 | } |
| 1456 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1457 | if (!ext || !fixed) |
| 1458 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1459 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1460 | return; /* no unsol support */ |
| 1461 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1462 | ext, fixed); |
| 1463 | spec->ext_mic.pin = ext; |
| 1464 | spec->int_mic.pin = fixed; |
| 1465 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1466 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1467 | spec->auto_mic = 1; |
| 1468 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1469 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1470 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1471 | spec->unsol_event = alc_sku_unsol_event; |
| 1472 | } |
| 1473 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1474 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1475 | * the driver to ignore any present sku defines. |
| 1476 | */ |
| 1477 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1478 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1479 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1480 | { |
| 1481 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1482 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1483 | struct alc_spec *spec = codec->spec; |
| 1484 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1485 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1486 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1487 | if (spec->cdefine.fixup) { |
| 1488 | ass = spec->cdefine.sku_cfg; |
| 1489 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1490 | return -1; |
| 1491 | goto do_sku; |
| 1492 | } |
| 1493 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1494 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1495 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1496 | goto do_sku; |
| 1497 | |
| 1498 | nid = 0x1d; |
| 1499 | if (codec->vendor_id == 0x10ec0260) |
| 1500 | nid = 0x17; |
| 1501 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1502 | |
| 1503 | if (!(ass & 1)) { |
| 1504 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1505 | codec->chip_name, ass); |
| 1506 | return -1; |
| 1507 | } |
| 1508 | |
| 1509 | /* check sum */ |
| 1510 | tmp = 0; |
| 1511 | for (i = 1; i < 16; i++) { |
| 1512 | if ((ass >> i) & 1) |
| 1513 | tmp++; |
| 1514 | } |
| 1515 | if (((ass >> 16) & 0xf) != tmp) |
| 1516 | return -1; |
| 1517 | |
| 1518 | spec->cdefine.port_connectivity = ass >> 30; |
| 1519 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1520 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1521 | spec->cdefine.customization = ass >> 8; |
| 1522 | do_sku: |
| 1523 | spec->cdefine.sku_cfg = ass; |
| 1524 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1525 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1526 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1527 | spec->cdefine.override = ass & 0x1; |
| 1528 | |
| 1529 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1530 | nid, spec->cdefine.sku_cfg); |
| 1531 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1532 | spec->cdefine.port_connectivity); |
| 1533 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1534 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1535 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1536 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1537 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1538 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1539 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1540 | |
| 1541 | return 0; |
| 1542 | } |
| 1543 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1544 | /* check subsystem ID and set up device-specific initialization; |
| 1545 | * return 1 if initialized, 0 if invalid SSID |
| 1546 | */ |
| 1547 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1548 | * 31 ~ 16 : Manufacture ID |
| 1549 | * 15 ~ 8 : SKU ID |
| 1550 | * 7 ~ 0 : Assembly ID |
| 1551 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1552 | */ |
| 1553 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1554 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1555 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1556 | { |
| 1557 | unsigned int ass, tmp, i; |
| 1558 | unsigned nid; |
| 1559 | struct alc_spec *spec = codec->spec; |
| 1560 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1561 | if (spec->cdefine.fixup) { |
| 1562 | ass = spec->cdefine.sku_cfg; |
| 1563 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1564 | return 0; |
| 1565 | goto do_sku; |
| 1566 | } |
| 1567 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1568 | ass = codec->subsystem_id & 0xffff; |
| 1569 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1570 | goto do_sku; |
| 1571 | |
| 1572 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1573 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1574 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1575 | * 29~21 : reserve |
| 1576 | * 20 : PCBEEP input |
| 1577 | * 19~16 : Check sum (15:1) |
| 1578 | * 15~1 : Custom |
| 1579 | * 0 : override |
| 1580 | */ |
| 1581 | nid = 0x1d; |
| 1582 | if (codec->vendor_id == 0x10ec0260) |
| 1583 | nid = 0x17; |
| 1584 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1585 | snd_printd("realtek: No valid SSID, " |
| 1586 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1587 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1588 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1589 | return 0; |
| 1590 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1591 | return 0; |
| 1592 | |
| 1593 | /* check sum */ |
| 1594 | tmp = 0; |
| 1595 | for (i = 1; i < 16; i++) { |
| 1596 | if ((ass >> i) & 1) |
| 1597 | tmp++; |
| 1598 | } |
| 1599 | if (((ass >> 16) & 0xf) != tmp) |
| 1600 | return 0; |
| 1601 | do_sku: |
| 1602 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1603 | ass & 0xffff, codec->vendor_id); |
| 1604 | /* |
| 1605 | * 0 : override |
| 1606 | * 1 : Swap Jack |
| 1607 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1608 | * 3~5 : External Amplifier control |
| 1609 | * 7~6 : Reserved |
| 1610 | */ |
| 1611 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1612 | switch (tmp) { |
| 1613 | case 1: |
| 1614 | spec->init_amp = ALC_INIT_GPIO1; |
| 1615 | break; |
| 1616 | case 3: |
| 1617 | spec->init_amp = ALC_INIT_GPIO2; |
| 1618 | break; |
| 1619 | case 7: |
| 1620 | spec->init_amp = ALC_INIT_GPIO3; |
| 1621 | break; |
| 1622 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1623 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1624 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1625 | break; |
| 1626 | } |
| 1627 | |
| 1628 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1629 | * when the external headphone out jack is plugged" |
| 1630 | */ |
| 1631 | if (!(ass & 0x8000)) |
| 1632 | return 1; |
| 1633 | /* |
| 1634 | * 10~8 : Jack location |
| 1635 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1636 | * 14~13: Resvered |
| 1637 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1638 | * when the external headphone out jack is plugged" |
| 1639 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1640 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1641 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1642 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1643 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1644 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1645 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1646 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1647 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1648 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1649 | else if (tmp == 3) |
| 1650 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1651 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1652 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1653 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1654 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1655 | return 1; |
| 1656 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1657 | } |
| 1658 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1659 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1660 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1661 | return 1; |
| 1662 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1663 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1664 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1665 | hda_nid_t porta, hda_nid_t porte, |
| 1666 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1667 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1668 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1669 | struct alc_spec *spec = codec->spec; |
| 1670 | snd_printd("realtek: " |
| 1671 | "Enable default setup for auto mode as fallback\n"); |
| 1672 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1673 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1674 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1675 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1676 | } |
| 1677 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1678 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1679 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1680 | */ |
| 1681 | |
| 1682 | struct alc_pincfg { |
| 1683 | hda_nid_t nid; |
| 1684 | u32 val; |
| 1685 | }; |
| 1686 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1687 | struct alc_model_fixup { |
| 1688 | const int id; |
| 1689 | const char *name; |
| 1690 | }; |
| 1691 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1692 | struct alc_fixup { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1693 | int type; |
Takashi Iwai | 361fe6e | 2011-01-14 09:55:32 +0100 | [diff] [blame] | 1694 | bool chained; |
| 1695 | int chain_id; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1696 | union { |
| 1697 | unsigned int sku; |
| 1698 | const struct alc_pincfg *pins; |
| 1699 | const struct hda_verb *verbs; |
| 1700 | void (*func)(struct hda_codec *codec, |
| 1701 | const struct alc_fixup *fix, |
| 1702 | int action); |
| 1703 | } v; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1704 | }; |
| 1705 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1706 | enum { |
| 1707 | ALC_FIXUP_INVALID, |
| 1708 | ALC_FIXUP_SKU, |
| 1709 | ALC_FIXUP_PINS, |
| 1710 | ALC_FIXUP_VERBS, |
| 1711 | ALC_FIXUP_FUNC, |
| 1712 | }; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1713 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1714 | enum { |
| 1715 | ALC_FIXUP_ACT_PRE_PROBE, |
| 1716 | ALC_FIXUP_ACT_PROBE, |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 1717 | ALC_FIXUP_ACT_INIT, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1718 | }; |
| 1719 | |
| 1720 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1721 | { |
| 1722 | struct alc_spec *spec = codec->spec; |
| 1723 | int id = spec->fixup_id; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1724 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1725 | const char *modelname = spec->fixup_name; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1726 | #endif |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1727 | int depth = 0; |
| 1728 | |
| 1729 | if (!spec->fixup_list) |
| 1730 | return; |
| 1731 | |
| 1732 | while (id >= 0) { |
| 1733 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1734 | const struct alc_pincfg *cfg; |
| 1735 | |
| 1736 | switch (fix->type) { |
| 1737 | case ALC_FIXUP_SKU: |
| 1738 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1739 | break;; |
| 1740 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1741 | "Apply sku override for %s\n", |
| 1742 | codec->chip_name, modelname); |
| 1743 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1744 | spec->cdefine.fixup = 1; |
| 1745 | break; |
| 1746 | case ALC_FIXUP_PINS: |
| 1747 | cfg = fix->v.pins; |
| 1748 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1749 | break; |
| 1750 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1751 | "Apply pincfg for %s\n", |
| 1752 | codec->chip_name, modelname); |
| 1753 | for (; cfg->nid; cfg++) |
| 1754 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1755 | cfg->val); |
| 1756 | break; |
| 1757 | case ALC_FIXUP_VERBS: |
| 1758 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1759 | break; |
| 1760 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1761 | "Apply fix-verbs for %s\n", |
| 1762 | codec->chip_name, modelname); |
| 1763 | add_verb(codec->spec, fix->v.verbs); |
| 1764 | break; |
| 1765 | case ALC_FIXUP_FUNC: |
| 1766 | if (!fix->v.func) |
| 1767 | break; |
| 1768 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1769 | "Apply fix-func for %s\n", |
| 1770 | codec->chip_name, modelname); |
| 1771 | fix->v.func(codec, fix, action); |
| 1772 | break; |
| 1773 | default: |
| 1774 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1775 | "Invalid fixup type %d\n", |
| 1776 | codec->chip_name, fix->type); |
| 1777 | break; |
| 1778 | } |
| 1779 | if (!fix[id].chained) |
| 1780 | break; |
| 1781 | if (++depth > 10) |
| 1782 | break; |
| 1783 | id = fix[id].chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1784 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1785 | } |
| 1786 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1787 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1788 | const struct alc_model_fixup *models, |
| 1789 | const struct snd_pci_quirk *quirk, |
| 1790 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1791 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1792 | struct alc_spec *spec = codec->spec; |
| 1793 | int id = -1; |
| 1794 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1795 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1796 | if (codec->modelname && models) { |
| 1797 | while (models->name) { |
| 1798 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1799 | id = models->id; |
| 1800 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1801 | break; |
| 1802 | } |
| 1803 | models++; |
| 1804 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1805 | } |
| 1806 | if (id < 0) { |
| 1807 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1808 | if (quirk) { |
| 1809 | id = quirk->value; |
| 1810 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1811 | name = quirk->name; |
| 1812 | #endif |
| 1813 | } |
| 1814 | } |
| 1815 | |
| 1816 | spec->fixup_id = id; |
| 1817 | if (id >= 0) { |
| 1818 | spec->fixup_list = fixlist; |
| 1819 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1820 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1821 | } |
| 1822 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1823 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1824 | unsigned int coef_idx) |
| 1825 | { |
| 1826 | unsigned int val; |
| 1827 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1828 | coef_idx); |
| 1829 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1830 | AC_VERB_GET_PROC_COEF, 0); |
| 1831 | return val; |
| 1832 | } |
| 1833 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1834 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1835 | unsigned int coef_val) |
| 1836 | { |
| 1837 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1838 | coef_idx); |
| 1839 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1840 | coef_val); |
| 1841 | } |
| 1842 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1843 | /* set right pin controls for digital I/O */ |
| 1844 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1845 | { |
| 1846 | struct alc_spec *spec = codec->spec; |
| 1847 | int i; |
| 1848 | hda_nid_t pin; |
| 1849 | |
| 1850 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1851 | pin = spec->autocfg.dig_out_pins[i]; |
| 1852 | if (pin) { |
| 1853 | snd_hda_codec_write(codec, pin, 0, |
| 1854 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1855 | PIN_OUT); |
| 1856 | } |
| 1857 | } |
| 1858 | pin = spec->autocfg.dig_in_pin; |
| 1859 | if (pin) |
| 1860 | snd_hda_codec_write(codec, pin, 0, |
| 1861 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1862 | PIN_IN); |
| 1863 | } |
| 1864 | |
| 1865 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1866 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1867 | { |
| 1868 | struct alc_spec *spec = codec->spec; |
| 1869 | int i, err; |
| 1870 | hda_nid_t dig_nid; |
| 1871 | |
| 1872 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1873 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1874 | err = snd_hda_get_connections(codec, |
| 1875 | spec->autocfg.dig_out_pins[i], |
| 1876 | &dig_nid, 1); |
| 1877 | if (err < 0) |
| 1878 | continue; |
| 1879 | if (!i) { |
| 1880 | spec->multiout.dig_out_nid = dig_nid; |
| 1881 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1882 | } else { |
| 1883 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1884 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1885 | break; |
| 1886 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1887 | } |
| 1888 | } |
| 1889 | |
| 1890 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1891 | dig_nid = codec->start_nid; |
| 1892 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1893 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1894 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1895 | continue; |
| 1896 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1897 | continue; |
| 1898 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1899 | continue; |
| 1900 | err = get_connection_index(codec, dig_nid, |
| 1901 | spec->autocfg.dig_in_pin); |
| 1902 | if (err >= 0) { |
| 1903 | spec->dig_in_nid = dig_nid; |
| 1904 | break; |
| 1905 | } |
| 1906 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1907 | } |
| 1908 | } |
| 1909 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1910 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1911 | * ALC888 |
| 1912 | */ |
| 1913 | |
| 1914 | /* |
| 1915 | * 2ch mode |
| 1916 | */ |
| 1917 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1918 | /* Mic-in jack as mic in */ |
| 1919 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1920 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1921 | /* Line-in jack as Line in */ |
| 1922 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1923 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1924 | /* Line-Out as Front */ |
| 1925 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1926 | { } /* end */ |
| 1927 | }; |
| 1928 | |
| 1929 | /* |
| 1930 | * 4ch mode |
| 1931 | */ |
| 1932 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1933 | /* Mic-in jack as mic in */ |
| 1934 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1935 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1936 | /* Line-in jack as Surround */ |
| 1937 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1938 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1939 | /* Line-Out as Front */ |
| 1940 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1941 | { } /* end */ |
| 1942 | }; |
| 1943 | |
| 1944 | /* |
| 1945 | * 6ch mode |
| 1946 | */ |
| 1947 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1948 | /* Mic-in jack as CLFE */ |
| 1949 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1950 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1951 | /* Line-in jack as Surround */ |
| 1952 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1953 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1954 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1955 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1956 | { } /* end */ |
| 1957 | }; |
| 1958 | |
| 1959 | /* |
| 1960 | * 8ch mode |
| 1961 | */ |
| 1962 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1963 | /* Mic-in jack as CLFE */ |
| 1964 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1965 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1966 | /* Line-in jack as Surround */ |
| 1967 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1968 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1969 | /* Line-Out as Side */ |
| 1970 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1971 | { } /* end */ |
| 1972 | }; |
| 1973 | |
| 1974 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1975 | { 2, alc888_4ST_ch2_intel_init }, |
| 1976 | { 4, alc888_4ST_ch4_intel_init }, |
| 1977 | { 6, alc888_4ST_ch6_intel_init }, |
| 1978 | { 8, alc888_4ST_ch8_intel_init }, |
| 1979 | }; |
| 1980 | |
| 1981 | /* |
| 1982 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1983 | */ |
| 1984 | |
| 1985 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1986 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1987 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1988 | /* Connect Internal HP to Front */ |
| 1989 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1990 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1991 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1992 | /* Connect Bass HP to Front */ |
| 1993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1994 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1995 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1996 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1997 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1998 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1999 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2000 | /* Connect Mic jack to CLFE */ |
| 2001 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2002 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2003 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2004 | /* Connect Line-in jack to Surround */ |
| 2005 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2006 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2007 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2008 | /* Connect HP out jack to Front */ |
| 2009 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2010 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2011 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2012 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 2013 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2014 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2015 | {} |
| 2016 | }; |
| 2017 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2018 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2019 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 2020 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2021 | } |
| 2022 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2023 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 2024 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2025 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2026 | if (codec->vendor_id == 0x10ec0880) |
| 2027 | res >>= 28; |
| 2028 | else |
| 2029 | res >>= 26; |
| 2030 | if (res == ALC880_HP_EVENT) |
| 2031 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2032 | } |
| 2033 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2034 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2035 | { |
| 2036 | struct alc_spec *spec = codec->spec; |
| 2037 | |
| 2038 | spec->autocfg.hp_pins[0] = 0x15; |
| 2039 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2040 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2041 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2042 | spec->autocfg.speaker_pins[3] = 0x19; |
| 2043 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2044 | } |
| 2045 | |
| 2046 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 2047 | { |
| 2048 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2049 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2050 | } |
| 2051 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2052 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2053 | { |
| 2054 | struct alc_spec *spec = codec->spec; |
| 2055 | |
| 2056 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 2057 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 2058 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 2059 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2060 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2061 | |
| 2062 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2063 | * ALC888 Acer Aspire 4930G model |
| 2064 | */ |
| 2065 | |
| 2066 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 2067 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2068 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2069 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2071 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2072 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2073 | /* Connect Internal HP to front */ |
| 2074 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2075 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2076 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2077 | /* Connect HP out to front */ |
| 2078 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2079 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2080 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2081 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2082 | { } |
| 2083 | }; |
| 2084 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2085 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2086 | * ALC888 Acer Aspire 6530G model |
| 2087 | */ |
| 2088 | |
| 2089 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2090 | /* Route to built-in subwoofer as well as speakers */ |
| 2091 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2092 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2093 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2094 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2095 | /* Bias voltage on for external mic port */ |
| 2096 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2097 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2098 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2099 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2101 | /* Enable unsolicited event for HP jack */ |
| 2102 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2103 | /* Enable speaker output */ |
| 2104 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2105 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2106 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2107 | /* Enable headphone output */ |
| 2108 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2110 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2111 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2112 | { } |
| 2113 | }; |
| 2114 | |
| 2115 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2116 | *ALC888 Acer Aspire 7730G model |
| 2117 | */ |
| 2118 | |
| 2119 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2120 | /* Bias voltage on for external mic port */ |
| 2121 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2122 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2123 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2124 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2125 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2126 | /* Enable unsolicited event for HP jack */ |
| 2127 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2128 | /* Enable speaker output */ |
| 2129 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2130 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2131 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2132 | /* Enable headphone output */ |
| 2133 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2134 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2135 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2136 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2137 | /*Enable internal subwoofer */ |
| 2138 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2139 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2140 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2141 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2142 | { } |
| 2143 | }; |
| 2144 | |
| 2145 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2146 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2147 | */ |
| 2148 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2149 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2150 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2151 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2152 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2153 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2154 | /* Enable unsolicited event for HP jack */ |
| 2155 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2156 | /* Connect Internal Front to Front */ |
| 2157 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2158 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2159 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2160 | /* Connect Internal Rear to Rear */ |
| 2161 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2162 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2163 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2164 | /* Connect Internal CLFE to CLFE */ |
| 2165 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2166 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2167 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2168 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2170 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2171 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2172 | /* Enable all DACs */ |
| 2173 | /* DAC DISABLE/MUTE 1? */ |
| 2174 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2175 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2176 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2177 | /* DAC DISABLE/MUTE 2? */ |
| 2178 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2179 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2180 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2181 | /* DMIC fix |
| 2182 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2183 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2184 | * makes the signal become a difference/sum signal instead of standard |
| 2185 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2186 | * codec replicate the sum signal to both channels, turning it into a |
| 2187 | * normal mono mic. |
| 2188 | */ |
| 2189 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2190 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2191 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2192 | { } |
| 2193 | }; |
| 2194 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2195 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2196 | /* Front mic only available on one ADC */ |
| 2197 | { |
| 2198 | .num_items = 4, |
| 2199 | .items = { |
| 2200 | { "Mic", 0x0 }, |
| 2201 | { "Line", 0x2 }, |
| 2202 | { "CD", 0x4 }, |
| 2203 | { "Front Mic", 0xb }, |
| 2204 | }, |
| 2205 | }, |
| 2206 | { |
| 2207 | .num_items = 3, |
| 2208 | .items = { |
| 2209 | { "Mic", 0x0 }, |
| 2210 | { "Line", 0x2 }, |
| 2211 | { "CD", 0x4 }, |
| 2212 | }, |
| 2213 | } |
| 2214 | }; |
| 2215 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2216 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2217 | /* Interal mic only available on one ADC */ |
| 2218 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2219 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2220 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2221 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2222 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2223 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2224 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2225 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2226 | }, |
| 2227 | }, |
| 2228 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2229 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2230 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2231 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2232 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2233 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2234 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2235 | }, |
| 2236 | } |
| 2237 | }; |
| 2238 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2239 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2240 | /* Digital mic only available on first "ADC" */ |
| 2241 | { |
| 2242 | .num_items = 5, |
| 2243 | .items = { |
| 2244 | { "Mic", 0x0 }, |
| 2245 | { "Line", 0x2 }, |
| 2246 | { "CD", 0x4 }, |
| 2247 | { "Front Mic", 0xb }, |
| 2248 | { "Input Mix", 0xa }, |
| 2249 | }, |
| 2250 | }, |
| 2251 | { |
| 2252 | .num_items = 4, |
| 2253 | .items = { |
| 2254 | { "Mic", 0x0 }, |
| 2255 | { "Line", 0x2 }, |
| 2256 | { "CD", 0x4 }, |
| 2257 | { "Input Mix", 0xa }, |
| 2258 | }, |
| 2259 | }, |
| 2260 | { |
| 2261 | .num_items = 4, |
| 2262 | .items = { |
| 2263 | { "Mic", 0x0 }, |
| 2264 | { "Line", 0x2 }, |
| 2265 | { "CD", 0x4 }, |
| 2266 | { "Input Mix", 0xa }, |
| 2267 | }, |
| 2268 | } |
| 2269 | }; |
| 2270 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2271 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2272 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2273 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2274 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2275 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2276 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2277 | HDA_OUTPUT), |
| 2278 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2279 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2280 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2281 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2282 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2283 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2284 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2285 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2286 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2288 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2289 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2290 | { } /* end */ |
| 2291 | }; |
| 2292 | |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2293 | static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { |
| 2294 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2295 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2296 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2297 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame^] | 2298 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2299 | HDA_OUTPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame^] | 2300 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2301 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2302 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2303 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
| 2304 | HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2305 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2306 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2307 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2308 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2309 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2310 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 2311 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2312 | { } /* end */ |
| 2313 | }; |
| 2314 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2315 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2316 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2317 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2318 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2319 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2320 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2321 | HDA_OUTPUT), |
| 2322 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2323 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2324 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2325 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2326 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2327 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2328 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2329 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2330 | { } /* end */ |
| 2331 | }; |
| 2332 | |
| 2333 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2334 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2335 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2336 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2337 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2338 | spec->autocfg.hp_pins[0] = 0x15; |
| 2339 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2340 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2341 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2342 | } |
| 2343 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2344 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2345 | { |
| 2346 | struct alc_spec *spec = codec->spec; |
| 2347 | |
| 2348 | spec->autocfg.hp_pins[0] = 0x15; |
| 2349 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2350 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2351 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2352 | } |
| 2353 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2354 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2355 | { |
| 2356 | struct alc_spec *spec = codec->spec; |
| 2357 | |
| 2358 | spec->autocfg.hp_pins[0] = 0x15; |
| 2359 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2360 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2361 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2362 | } |
| 2363 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2364 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2365 | { |
| 2366 | struct alc_spec *spec = codec->spec; |
| 2367 | |
| 2368 | spec->autocfg.hp_pins[0] = 0x15; |
| 2369 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2370 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2371 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2372 | } |
| 2373 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2374 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2375 | * ALC880 3-stack model |
| 2376 | * |
| 2377 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2378 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2379 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2380 | */ |
| 2381 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2382 | static hda_nid_t alc880_dac_nids[4] = { |
| 2383 | /* front, rear, clfe, rear_surr */ |
| 2384 | 0x02, 0x05, 0x04, 0x03 |
| 2385 | }; |
| 2386 | |
| 2387 | static hda_nid_t alc880_adc_nids[3] = { |
| 2388 | /* ADC0-2 */ |
| 2389 | 0x07, 0x08, 0x09, |
| 2390 | }; |
| 2391 | |
| 2392 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2393 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2394 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2395 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2396 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2397 | /* ADC1-2 */ |
| 2398 | 0x08, 0x09, |
| 2399 | }; |
| 2400 | |
| 2401 | #define ALC880_DIGOUT_NID 0x06 |
| 2402 | #define ALC880_DIGIN_NID 0x0a |
| 2403 | |
| 2404 | static struct hda_input_mux alc880_capture_source = { |
| 2405 | .num_items = 4, |
| 2406 | .items = { |
| 2407 | { "Mic", 0x0 }, |
| 2408 | { "Front Mic", 0x3 }, |
| 2409 | { "Line", 0x2 }, |
| 2410 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2411 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2412 | }; |
| 2413 | |
| 2414 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2415 | /* 2ch mode */ |
| 2416 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2417 | /* set line-in to input, mute it */ |
| 2418 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2419 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2420 | /* set mic-in to input vref 80%, mute it */ |
| 2421 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2422 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2423 | { } /* end */ |
| 2424 | }; |
| 2425 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2426 | /* 6ch mode */ |
| 2427 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2428 | /* set line-in to output, unmute it */ |
| 2429 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2430 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2431 | /* set mic-in to output, unmute it */ |
| 2432 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2433 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2434 | { } /* end */ |
| 2435 | }; |
| 2436 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2437 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2438 | { 2, alc880_threestack_ch2_init }, |
| 2439 | { 6, alc880_threestack_ch6_init }, |
| 2440 | }; |
| 2441 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2442 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2443 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2444 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2445 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2446 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2447 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2448 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2449 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2450 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2451 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2452 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2453 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2454 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2455 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2456 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2457 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2458 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2459 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2460 | { |
| 2461 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2462 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2463 | .info = alc_ch_mode_info, |
| 2464 | .get = alc_ch_mode_get, |
| 2465 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2466 | }, |
| 2467 | { } /* end */ |
| 2468 | }; |
| 2469 | |
| 2470 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2471 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2472 | struct snd_ctl_elem_info *uinfo) |
| 2473 | { |
| 2474 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2475 | struct alc_spec *spec = codec->spec; |
| 2476 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2477 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2478 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2479 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2480 | HDA_INPUT); |
| 2481 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2482 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2483 | return err; |
| 2484 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2485 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2486 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2487 | unsigned int size, unsigned int __user *tlv) |
| 2488 | { |
| 2489 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2490 | struct alc_spec *spec = codec->spec; |
| 2491 | int err; |
| 2492 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2493 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2494 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2495 | HDA_INPUT); |
| 2496 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2497 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2498 | return err; |
| 2499 | } |
| 2500 | |
| 2501 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2502 | struct snd_ctl_elem_value *ucontrol); |
| 2503 | |
| 2504 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2505 | struct snd_ctl_elem_value *ucontrol, |
| 2506 | getput_call_t func) |
| 2507 | { |
| 2508 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2509 | struct alc_spec *spec = codec->spec; |
| 2510 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2511 | int err; |
| 2512 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2513 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2514 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2515 | 3, 0, HDA_INPUT); |
| 2516 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2517 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2518 | return err; |
| 2519 | } |
| 2520 | |
| 2521 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2522 | struct snd_ctl_elem_value *ucontrol) |
| 2523 | { |
| 2524 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2525 | snd_hda_mixer_amp_volume_get); |
| 2526 | } |
| 2527 | |
| 2528 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2529 | struct snd_ctl_elem_value *ucontrol) |
| 2530 | { |
| 2531 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2532 | snd_hda_mixer_amp_volume_put); |
| 2533 | } |
| 2534 | |
| 2535 | /* capture mixer elements */ |
| 2536 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2537 | |
| 2538 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2539 | struct snd_ctl_elem_value *ucontrol) |
| 2540 | { |
| 2541 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2542 | snd_hda_mixer_amp_switch_get); |
| 2543 | } |
| 2544 | |
| 2545 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2546 | struct snd_ctl_elem_value *ucontrol) |
| 2547 | { |
| 2548 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2549 | snd_hda_mixer_amp_switch_put); |
| 2550 | } |
| 2551 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2552 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2553 | { \ |
| 2554 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2555 | .name = "Capture Switch", \ |
| 2556 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2557 | .count = num, \ |
| 2558 | .info = alc_cap_sw_info, \ |
| 2559 | .get = alc_cap_sw_get, \ |
| 2560 | .put = alc_cap_sw_put, \ |
| 2561 | }, \ |
| 2562 | { \ |
| 2563 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2564 | .name = "Capture Volume", \ |
| 2565 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2566 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2567 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2568 | .count = num, \ |
| 2569 | .info = alc_cap_vol_info, \ |
| 2570 | .get = alc_cap_vol_get, \ |
| 2571 | .put = alc_cap_vol_put, \ |
| 2572 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2573 | } |
| 2574 | |
| 2575 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2576 | { \ |
| 2577 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2578 | /* .name = "Capture Source", */ \ |
| 2579 | .name = "Input Source", \ |
| 2580 | .count = num, \ |
| 2581 | .info = alc_mux_enum_info, \ |
| 2582 | .get = alc_mux_enum_get, \ |
| 2583 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2584 | } |
| 2585 | |
| 2586 | #define DEFINE_CAPMIX(num) \ |
| 2587 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2588 | _DEFINE_CAPMIX(num), \ |
| 2589 | _DEFINE_CAPSRC(num), \ |
| 2590 | { } /* end */ \ |
| 2591 | } |
| 2592 | |
| 2593 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2594 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2595 | _DEFINE_CAPMIX(num), \ |
| 2596 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2597 | } |
| 2598 | |
| 2599 | /* up to three ADCs */ |
| 2600 | DEFINE_CAPMIX(1); |
| 2601 | DEFINE_CAPMIX(2); |
| 2602 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2603 | DEFINE_CAPMIX_NOSRC(1); |
| 2604 | DEFINE_CAPMIX_NOSRC(2); |
| 2605 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2606 | |
| 2607 | /* |
| 2608 | * ALC880 5-stack model |
| 2609 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2610 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2611 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2612 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2613 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2614 | */ |
| 2615 | |
| 2616 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2617 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2618 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2619 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2620 | { } /* end */ |
| 2621 | }; |
| 2622 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2623 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2624 | /* 6ch mode */ |
| 2625 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2626 | /* set line-in to input, mute it */ |
| 2627 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2628 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2629 | { } /* end */ |
| 2630 | }; |
| 2631 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2632 | /* 8ch mode */ |
| 2633 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2634 | /* set line-in to output, unmute it */ |
| 2635 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2636 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2637 | { } /* end */ |
| 2638 | }; |
| 2639 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2640 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2641 | { 6, alc880_fivestack_ch6_init }, |
| 2642 | { 8, alc880_fivestack_ch8_init }, |
| 2643 | }; |
| 2644 | |
| 2645 | |
| 2646 | /* |
| 2647 | * ALC880 6-stack model |
| 2648 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2649 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2650 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2651 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2652 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2653 | */ |
| 2654 | |
| 2655 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2656 | /* front, rear, clfe, rear_surr */ |
| 2657 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2658 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2659 | |
| 2660 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2661 | .num_items = 4, |
| 2662 | .items = { |
| 2663 | { "Mic", 0x0 }, |
| 2664 | { "Front Mic", 0x1 }, |
| 2665 | { "Line", 0x2 }, |
| 2666 | { "CD", 0x4 }, |
| 2667 | }, |
| 2668 | }; |
| 2669 | |
| 2670 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2671 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2672 | { 8, NULL }, |
| 2673 | }; |
| 2674 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2675 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2676 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2677 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2678 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2679 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2680 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2681 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2682 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2683 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2684 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2685 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2686 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2687 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2688 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2689 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2692 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2693 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2694 | { |
| 2695 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2696 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2697 | .info = alc_ch_mode_info, |
| 2698 | .get = alc_ch_mode_get, |
| 2699 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2700 | }, |
| 2701 | { } /* end */ |
| 2702 | }; |
| 2703 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2704 | |
| 2705 | /* |
| 2706 | * ALC880 W810 model |
| 2707 | * |
| 2708 | * W810 has rear IO for: |
| 2709 | * Front (DAC 02) |
| 2710 | * Surround (DAC 03) |
| 2711 | * Center/LFE (DAC 04) |
| 2712 | * Digital out (06) |
| 2713 | * |
| 2714 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2715 | * 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] | 2716 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2717 | * There is a variable resistor to control the speaker or headphone |
| 2718 | * volume. This is a hardware-only device without a software API. |
| 2719 | * |
| 2720 | * Plugging headphones in will disable the internal speakers. This is |
| 2721 | * implemented in hardware, not via the driver using jack sense. In |
| 2722 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2723 | * disable both the speakers and headphones. |
| 2724 | * |
| 2725 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2726 | * These may not do anything useful with this driver yet, because I |
| 2727 | * haven't setup any initialization verbs for these yet... |
| 2728 | */ |
| 2729 | |
| 2730 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2731 | /* front, rear/surround, clfe */ |
| 2732 | 0x02, 0x03, 0x04 |
| 2733 | }; |
| 2734 | |
| 2735 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2736 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2737 | { 6, NULL } |
| 2738 | }; |
| 2739 | |
| 2740 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2741 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2742 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2743 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2744 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2745 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2746 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2747 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2748 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2749 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2750 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2751 | { } /* end */ |
| 2752 | }; |
| 2753 | |
| 2754 | |
| 2755 | /* |
| 2756 | * Z710V model |
| 2757 | * |
| 2758 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2759 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2760 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2761 | */ |
| 2762 | |
| 2763 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2764 | 0x02 |
| 2765 | }; |
| 2766 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2767 | |
| 2768 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2769 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2770 | { 2, NULL } |
| 2771 | }; |
| 2772 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2773 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2774 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2775 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2776 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2777 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2778 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2779 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2780 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2781 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2782 | { } /* end */ |
| 2783 | }; |
| 2784 | |
| 2785 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2786 | /* |
| 2787 | * ALC880 F1734 model |
| 2788 | * |
| 2789 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2790 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2791 | */ |
| 2792 | |
| 2793 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2794 | 0x03 |
| 2795 | }; |
| 2796 | #define ALC880_F1734_HP_DAC 0x02 |
| 2797 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2798 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2799 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2800 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2801 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2802 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2803 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2804 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2805 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2807 | { } /* end */ |
| 2808 | }; |
| 2809 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2810 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2811 | .num_items = 2, |
| 2812 | .items = { |
| 2813 | { "Mic", 0x1 }, |
| 2814 | { "CD", 0x4 }, |
| 2815 | }, |
| 2816 | }; |
| 2817 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2818 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2819 | /* |
| 2820 | * ALC880 ASUS model |
| 2821 | * |
| 2822 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2823 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2824 | * Mic = 0x18, Line = 0x1a |
| 2825 | */ |
| 2826 | |
| 2827 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2828 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2829 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2830 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2831 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2832 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2833 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2834 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2835 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2836 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2837 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2838 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2839 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2840 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2841 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2842 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2843 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2844 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2845 | { |
| 2846 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2847 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2848 | .info = alc_ch_mode_info, |
| 2849 | .get = alc_ch_mode_get, |
| 2850 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2851 | }, |
| 2852 | { } /* end */ |
| 2853 | }; |
| 2854 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2855 | /* |
| 2856 | * ALC880 ASUS W1V model |
| 2857 | * |
| 2858 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2859 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2860 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2861 | */ |
| 2862 | |
| 2863 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2864 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2865 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2866 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2867 | { } /* end */ |
| 2868 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2869 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2870 | /* TCL S700 */ |
| 2871 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2872 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2873 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2874 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2875 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2876 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2877 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2878 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2879 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2880 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2881 | { } /* end */ |
| 2882 | }; |
| 2883 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2884 | /* Uniwill */ |
| 2885 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2886 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2887 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2888 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2889 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2890 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2891 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2892 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2893 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2894 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2895 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2896 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2897 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2900 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2901 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2902 | { |
| 2903 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2904 | .name = "Channel Mode", |
| 2905 | .info = alc_ch_mode_info, |
| 2906 | .get = alc_ch_mode_get, |
| 2907 | .put = alc_ch_mode_put, |
| 2908 | }, |
| 2909 | { } /* end */ |
| 2910 | }; |
| 2911 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2912 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2913 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2914 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2915 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2916 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2917 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2918 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2919 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2920 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2921 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2922 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2923 | { } /* end */ |
| 2924 | }; |
| 2925 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2926 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2927 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2928 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2929 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2930 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2931 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2932 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2933 | { } /* end */ |
| 2934 | }; |
| 2935 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2936 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2937 | * virtual master controls |
| 2938 | */ |
| 2939 | |
| 2940 | /* |
| 2941 | * slave controls for virtual master |
| 2942 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2943 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2944 | "Front Playback Volume", |
| 2945 | "Surround Playback Volume", |
| 2946 | "Center Playback Volume", |
| 2947 | "LFE Playback Volume", |
| 2948 | "Side Playback Volume", |
| 2949 | "Headphone Playback Volume", |
| 2950 | "Speaker Playback Volume", |
| 2951 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2952 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2953 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2954 | NULL, |
| 2955 | }; |
| 2956 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2957 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2958 | "Front Playback Switch", |
| 2959 | "Surround Playback Switch", |
| 2960 | "Center Playback Switch", |
| 2961 | "LFE Playback Switch", |
| 2962 | "Side Playback Switch", |
| 2963 | "Headphone Playback Switch", |
| 2964 | "Speaker Playback Switch", |
| 2965 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2966 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2967 | "Line-Out Playback Switch", |
| 2968 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2969 | NULL, |
| 2970 | }; |
| 2971 | |
| 2972 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2973 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2974 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2975 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2976 | #define NID_MAPPING (-1) |
| 2977 | |
| 2978 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2979 | #define SUBDEV_HP_ (1 << 6) |
| 2980 | #define SUBDEV_LINE_ (2 << 6) |
| 2981 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2982 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2983 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2984 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2985 | static void alc_free_kctls(struct hda_codec *codec); |
| 2986 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2987 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2988 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2989 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2990 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2991 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2992 | { } /* end */ |
| 2993 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2994 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2995 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2996 | static int alc_build_controls(struct hda_codec *codec) |
| 2997 | { |
| 2998 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2999 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3000 | struct snd_kcontrol_new *knew; |
| 3001 | int i, j, err; |
| 3002 | unsigned int u; |
| 3003 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3004 | |
| 3005 | for (i = 0; i < spec->num_mixers; i++) { |
| 3006 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 3007 | if (err < 0) |
| 3008 | return err; |
| 3009 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3010 | if (spec->cap_mixer) { |
| 3011 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 3012 | if (err < 0) |
| 3013 | return err; |
| 3014 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3015 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3016 | err = snd_hda_create_spdif_out_ctls(codec, |
| 3017 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3018 | if (err < 0) |
| 3019 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3020 | if (!spec->no_analog) { |
| 3021 | err = snd_hda_create_spdif_share_sw(codec, |
| 3022 | &spec->multiout); |
| 3023 | if (err < 0) |
| 3024 | return err; |
| 3025 | spec->multiout.share_spdif = 1; |
| 3026 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3027 | } |
| 3028 | if (spec->dig_in_nid) { |
| 3029 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 3030 | if (err < 0) |
| 3031 | return err; |
| 3032 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3033 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3034 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3035 | /* create beep controls if needed */ |
| 3036 | if (spec->beep_amp) { |
| 3037 | struct snd_kcontrol_new *knew; |
| 3038 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 3039 | struct snd_kcontrol *kctl; |
| 3040 | kctl = snd_ctl_new1(knew, codec); |
| 3041 | if (!kctl) |
| 3042 | return -ENOMEM; |
| 3043 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 3044 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3045 | if (err < 0) |
| 3046 | return err; |
| 3047 | } |
| 3048 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3049 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3050 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3051 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3052 | if (!spec->no_analog && |
| 3053 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3054 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3055 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3056 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3057 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3058 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3059 | if (err < 0) |
| 3060 | return err; |
| 3061 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3062 | if (!spec->no_analog && |
| 3063 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3064 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 3065 | NULL, alc_slave_sws); |
| 3066 | if (err < 0) |
| 3067 | return err; |
| 3068 | } |
| 3069 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3070 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 3071 | if (spec->capsrc_nids || spec->adc_nids) { |
| 3072 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 3073 | if (!kctl) |
| 3074 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3075 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3076 | hda_nid_t *nids = spec->capsrc_nids; |
| 3077 | if (!nids) |
| 3078 | nids = spec->adc_nids; |
| 3079 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3080 | if (err < 0) |
| 3081 | return err; |
| 3082 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3083 | } |
| 3084 | if (spec->cap_mixer) { |
| 3085 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3086 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3087 | if (kname && strcmp(knew->name, kname) == 0) |
| 3088 | continue; |
| 3089 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3090 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3091 | err = snd_hda_add_nid(codec, kctl, i, |
| 3092 | spec->adc_nids[i]); |
| 3093 | if (err < 0) |
| 3094 | return err; |
| 3095 | } |
| 3096 | } |
| 3097 | } |
| 3098 | |
| 3099 | /* other nid->control mapping */ |
| 3100 | for (i = 0; i < spec->num_mixers; i++) { |
| 3101 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3102 | if (knew->iface != NID_MAPPING) |
| 3103 | continue; |
| 3104 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3105 | if (kctl == NULL) |
| 3106 | continue; |
| 3107 | u = knew->subdevice; |
| 3108 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3109 | nid = u & 0x3f; |
| 3110 | if (nid == 0) |
| 3111 | continue; |
| 3112 | switch (u & 0xc0) { |
| 3113 | case SUBDEV_SPEAKER_: |
| 3114 | nid = spec->autocfg.speaker_pins[nid]; |
| 3115 | break; |
| 3116 | case SUBDEV_LINE_: |
| 3117 | nid = spec->autocfg.line_out_pins[nid]; |
| 3118 | break; |
| 3119 | case SUBDEV_HP_: |
| 3120 | nid = spec->autocfg.hp_pins[nid]; |
| 3121 | break; |
| 3122 | default: |
| 3123 | continue; |
| 3124 | } |
| 3125 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3126 | if (err < 0) |
| 3127 | return err; |
| 3128 | } |
| 3129 | u = knew->private_value; |
| 3130 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3131 | nid = u & 0xff; |
| 3132 | if (nid == 0) |
| 3133 | continue; |
| 3134 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3135 | if (err < 0) |
| 3136 | return err; |
| 3137 | } |
| 3138 | } |
| 3139 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3140 | |
| 3141 | alc_free_kctls(codec); /* no longer needed */ |
| 3142 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3143 | return 0; |
| 3144 | } |
| 3145 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3146 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3147 | /* |
| 3148 | * initialize the codec volumes, etc |
| 3149 | */ |
| 3150 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3151 | /* |
| 3152 | * generic initialization of ADC, input mixers and output mixers |
| 3153 | */ |
| 3154 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3155 | /* |
| 3156 | * Unmute ADC0-2 and set the default input to mic-in |
| 3157 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3158 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3159 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3160 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3161 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3162 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3163 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3164 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3165 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3166 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3167 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3168 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3169 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3170 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3171 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3172 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3173 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3174 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3175 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3176 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3177 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3178 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3179 | /* |
| 3180 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3181 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3182 | /* set vol=0 to output mixers */ |
| 3183 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3184 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3185 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3186 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3187 | /* set up input amps for analog loopback */ |
| 3188 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3189 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3191 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3192 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3193 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3194 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3195 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3196 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3197 | |
| 3198 | { } |
| 3199 | }; |
| 3200 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3201 | /* |
| 3202 | * 3-stack pin configuration: |
| 3203 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3204 | */ |
| 3205 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3206 | /* |
| 3207 | * preset connection lists of input pins |
| 3208 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3209 | */ |
| 3210 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3211 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3212 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3213 | |
| 3214 | /* |
| 3215 | * Set pin mode and muting |
| 3216 | */ |
| 3217 | /* set front pin widgets 0x14 for output */ |
| 3218 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3220 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3221 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3222 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3223 | /* Mic2 (as headphone out) for HP output */ |
| 3224 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3225 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3226 | /* Line In pin widget for input */ |
| 3227 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3228 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3229 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3230 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3231 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3232 | /* CD pin widget for input */ |
| 3233 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3234 | |
| 3235 | { } |
| 3236 | }; |
| 3237 | |
| 3238 | /* |
| 3239 | * 5-stack pin configuration: |
| 3240 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3241 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3242 | */ |
| 3243 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3244 | /* |
| 3245 | * preset connection lists of input pins |
| 3246 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3247 | */ |
| 3248 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3249 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3250 | |
| 3251 | /* |
| 3252 | * Set pin mode and muting |
| 3253 | */ |
| 3254 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3255 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3257 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3258 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3259 | /* unmute pins for output (no gain on this amp) */ |
| 3260 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3261 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3262 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3263 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3264 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3265 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3266 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3267 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3268 | /* Mic2 (as headphone out) for HP output */ |
| 3269 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3270 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3271 | /* Line In pin widget for input */ |
| 3272 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3273 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3274 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3275 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3276 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3277 | /* CD pin widget for input */ |
| 3278 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3279 | |
| 3280 | { } |
| 3281 | }; |
| 3282 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3283 | /* |
| 3284 | * W810 pin configuration: |
| 3285 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3286 | */ |
| 3287 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3288 | /* hphone/speaker input selector: front DAC */ |
| 3289 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3290 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3292 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3293 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3294 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3295 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3296 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3297 | |
| 3298 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3299 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3300 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3301 | { } |
| 3302 | }; |
| 3303 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3304 | /* |
| 3305 | * Z71V pin configuration: |
| 3306 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3307 | */ |
| 3308 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3309 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3310 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3311 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3312 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3313 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3314 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3315 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3316 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3317 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3318 | |
| 3319 | { } |
| 3320 | }; |
| 3321 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3322 | /* |
| 3323 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3324 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3325 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3326 | */ |
| 3327 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3328 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3329 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3330 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3331 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3332 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3333 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3334 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3335 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3336 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3337 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3338 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3339 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3340 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3341 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3342 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3343 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3344 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3345 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3346 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3347 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3348 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3349 | { } |
| 3350 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3351 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3352 | /* |
| 3353 | * Uniwill pin configuration: |
| 3354 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3355 | * line = 0x1a |
| 3356 | */ |
| 3357 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3358 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3359 | |
| 3360 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3361 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3362 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3363 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3364 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3365 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3366 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3367 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3368 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3369 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3370 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3371 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3372 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3373 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3374 | |
| 3375 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3376 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3377 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3378 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3379 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3380 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3381 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3382 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3383 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3384 | |
| 3385 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3386 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3387 | |
| 3388 | { } |
| 3389 | }; |
| 3390 | |
| 3391 | /* |
| 3392 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3393 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3394 | */ |
| 3395 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3396 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3397 | |
| 3398 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3399 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3400 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3401 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3402 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3403 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3404 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3405 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3406 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3407 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3408 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3409 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3410 | |
| 3411 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3412 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3413 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3414 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3415 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3416 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3417 | |
| 3418 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3419 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3420 | |
| 3421 | { } |
| 3422 | }; |
| 3423 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3424 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3425 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3426 | { } |
| 3427 | }; |
| 3428 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3429 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3430 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3431 | { |
| 3432 | unsigned int present; |
| 3433 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3434 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3435 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3436 | bits = present ? HDA_AMP_MUTE : 0; |
| 3437 | 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] | 3438 | } |
| 3439 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3440 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3441 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3442 | struct alc_spec *spec = codec->spec; |
| 3443 | |
| 3444 | spec->autocfg.hp_pins[0] = 0x14; |
| 3445 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3446 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3447 | } |
| 3448 | |
| 3449 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3450 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3451 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3452 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3453 | } |
| 3454 | |
| 3455 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3456 | unsigned int res) |
| 3457 | { |
| 3458 | /* Looks like the unsol event is incompatible with the standard |
| 3459 | * definition. 4bit tag is placed at 28 bit! |
| 3460 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3461 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3462 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3463 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3464 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3465 | default: |
| 3466 | alc_automute_amp_unsol_event(codec, res); |
| 3467 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3468 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3469 | } |
| 3470 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3471 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3472 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3473 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3474 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3475 | spec->autocfg.hp_pins[0] = 0x14; |
| 3476 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3477 | } |
| 3478 | |
| 3479 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3480 | { |
| 3481 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3482 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3483 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3484 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3485 | present &= HDA_AMP_VOLMASK; |
| 3486 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3487 | HDA_AMP_VOLMASK, present); |
| 3488 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3489 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3490 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3491 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3492 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3493 | unsigned int res) |
| 3494 | { |
| 3495 | /* Looks like the unsol event is incompatible with the standard |
| 3496 | * definition. 4bit tag is placed at 28 bit! |
| 3497 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3498 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3499 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3500 | else |
| 3501 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3502 | } |
| 3503 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3504 | /* |
| 3505 | * F1734 pin configuration: |
| 3506 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3507 | */ |
| 3508 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3509 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3510 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3511 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3512 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3513 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3514 | |
| 3515 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3516 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3517 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3518 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3519 | |
| 3520 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3521 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3522 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3523 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3524 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3525 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3526 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3527 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3528 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3529 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3530 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3531 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3532 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3533 | { } |
| 3534 | }; |
| 3535 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3536 | /* |
| 3537 | * ASUS pin configuration: |
| 3538 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3539 | */ |
| 3540 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3541 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3542 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3543 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3544 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3545 | |
| 3546 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3547 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3548 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3549 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3550 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3551 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3552 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3553 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3554 | |
| 3555 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3556 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3557 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3558 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3559 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3560 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3561 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3562 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3563 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3564 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3565 | { } |
| 3566 | }; |
| 3567 | |
| 3568 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3569 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3570 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3571 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3572 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3573 | /* Clevo m520g init */ |
| 3574 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3575 | /* headphone output */ |
| 3576 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3577 | /* line-out */ |
| 3578 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3579 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3580 | /* Line-in */ |
| 3581 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3582 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3583 | /* CD */ |
| 3584 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3585 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3586 | /* Mic1 (rear panel) */ |
| 3587 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3588 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3589 | /* Mic2 (front panel) */ |
| 3590 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3591 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3592 | /* headphone */ |
| 3593 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3594 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3595 | /* change to EAPD mode */ |
| 3596 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3597 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3598 | |
| 3599 | { } |
| 3600 | }; |
| 3601 | |
| 3602 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3603 | /* change to EAPD mode */ |
| 3604 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3605 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3606 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3607 | /* Headphone output */ |
| 3608 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3609 | /* Front output*/ |
| 3610 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3611 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3612 | |
| 3613 | /* Line In pin widget for input */ |
| 3614 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3615 | /* CD pin widget for input */ |
| 3616 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3617 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3618 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3619 | |
| 3620 | /* change to EAPD mode */ |
| 3621 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3622 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3623 | |
| 3624 | { } |
| 3625 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3626 | |
| 3627 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3628 | * LG m1 express dual |
| 3629 | * |
| 3630 | * Pin assignment: |
| 3631 | * Rear Line-In/Out (blue): 0x14 |
| 3632 | * Build-in Mic-In: 0x15 |
| 3633 | * Speaker-out: 0x17 |
| 3634 | * HP-Out (green): 0x1b |
| 3635 | * Mic-In/Out (red): 0x19 |
| 3636 | * SPDIF-Out: 0x1e |
| 3637 | */ |
| 3638 | |
| 3639 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3640 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3641 | 0x05, 0x02, 0x03 |
| 3642 | }; |
| 3643 | |
| 3644 | /* seems analog CD is not working */ |
| 3645 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3646 | .num_items = 3, |
| 3647 | .items = { |
| 3648 | { "Mic", 0x1 }, |
| 3649 | { "Line", 0x5 }, |
| 3650 | { "Internal Mic", 0x6 }, |
| 3651 | }, |
| 3652 | }; |
| 3653 | |
| 3654 | /* 2,4,6 channel modes */ |
| 3655 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3656 | /* set line-in and mic-in to input */ |
| 3657 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3658 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3659 | { } |
| 3660 | }; |
| 3661 | |
| 3662 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3663 | /* set line-in to out and mic-in to input */ |
| 3664 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3665 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3666 | { } |
| 3667 | }; |
| 3668 | |
| 3669 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3670 | /* set line-in and mic-in to output */ |
| 3671 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3672 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3673 | { } |
| 3674 | }; |
| 3675 | |
| 3676 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3677 | { 2, alc880_lg_ch2_init }, |
| 3678 | { 4, alc880_lg_ch4_init }, |
| 3679 | { 6, alc880_lg_ch6_init }, |
| 3680 | }; |
| 3681 | |
| 3682 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3683 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3684 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3685 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3686 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3687 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3688 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3689 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3690 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3693 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3694 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3695 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3696 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3697 | { |
| 3698 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3699 | .name = "Channel Mode", |
| 3700 | .info = alc_ch_mode_info, |
| 3701 | .get = alc_ch_mode_get, |
| 3702 | .put = alc_ch_mode_put, |
| 3703 | }, |
| 3704 | { } /* end */ |
| 3705 | }; |
| 3706 | |
| 3707 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3708 | /* set capture source to mic-in */ |
| 3709 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3710 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3711 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3712 | /* mute all amp mixer inputs */ |
| 3713 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3714 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3715 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3716 | /* line-in to input */ |
| 3717 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3718 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3719 | /* built-in mic */ |
| 3720 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3721 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3722 | /* speaker-out */ |
| 3723 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3724 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3725 | /* mic-in to input */ |
| 3726 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3727 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3728 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3729 | /* HP-out */ |
| 3730 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3731 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3732 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3733 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3734 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3735 | { } |
| 3736 | }; |
| 3737 | |
| 3738 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3739 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3740 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3741 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3742 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3743 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3744 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3745 | } |
| 3746 | |
| 3747 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3748 | * LG LW20 |
| 3749 | * |
| 3750 | * Pin assignment: |
| 3751 | * Speaker-out: 0x14 |
| 3752 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3753 | * Built-in Mic-In: 0x19 |
| 3754 | * Line-In: 0x1b |
| 3755 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3756 | * SPDIF-Out: 0x1e |
| 3757 | */ |
| 3758 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3759 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3760 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3761 | .items = { |
| 3762 | { "Mic", 0x0 }, |
| 3763 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3764 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3765 | }, |
| 3766 | }; |
| 3767 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3768 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3769 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3770 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3771 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3772 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3773 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3774 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3775 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3776 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3777 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3778 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3779 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3780 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3781 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3782 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3783 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3784 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3785 | { |
| 3786 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3787 | .name = "Channel Mode", |
| 3788 | .info = alc_ch_mode_info, |
| 3789 | .get = alc_ch_mode_get, |
| 3790 | .put = alc_ch_mode_put, |
| 3791 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3792 | { } /* end */ |
| 3793 | }; |
| 3794 | |
| 3795 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3796 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3797 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3798 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3799 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3800 | /* set capture source to mic-in */ |
| 3801 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3802 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3803 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3804 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3805 | /* speaker-out */ |
| 3806 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3807 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3808 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3809 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3810 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3811 | /* mic-in to input */ |
| 3812 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3813 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3814 | /* built-in mic */ |
| 3815 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3816 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3817 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3818 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3819 | { } |
| 3820 | }; |
| 3821 | |
| 3822 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3823 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3824 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3825 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3826 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3827 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3828 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3829 | } |
| 3830 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3831 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3832 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3833 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3834 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3835 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3836 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3837 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3838 | { } /* end */ |
| 3839 | }; |
| 3840 | |
| 3841 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3842 | .num_items = 2, |
| 3843 | .items = { |
| 3844 | { "Mic", 0x0 }, |
| 3845 | { "Internal Mic", 0x1 }, |
| 3846 | }, |
| 3847 | }; |
| 3848 | |
| 3849 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3850 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3851 | |
| 3852 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3853 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3854 | |
| 3855 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3856 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3857 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3858 | /* Mic2 (as headphone out) for HP output */ |
| 3859 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3860 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3861 | /* Internal Speaker */ |
| 3862 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3863 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3864 | |
| 3865 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3866 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3867 | |
| 3868 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3869 | { } |
| 3870 | }; |
| 3871 | |
| 3872 | /* toggle speaker-output according to the hp-jack state */ |
| 3873 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3874 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3875 | struct alc_spec *spec = codec->spec; |
| 3876 | alc_automute_amp(codec); |
| 3877 | /* toggle EAPD */ |
| 3878 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3879 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3880 | else |
| 3881 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3882 | } |
| 3883 | |
| 3884 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3885 | unsigned int res) |
| 3886 | { |
| 3887 | /* Looks like the unsol event is incompatible with the standard |
| 3888 | * definition. 4bit tag is placed at 28 bit! |
| 3889 | */ |
| 3890 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3891 | alc880_medion_rim_automute(codec); |
| 3892 | } |
| 3893 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3894 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3895 | { |
| 3896 | struct alc_spec *spec = codec->spec; |
| 3897 | |
| 3898 | spec->autocfg.hp_pins[0] = 0x14; |
| 3899 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3900 | } |
| 3901 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3902 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3903 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3904 | { 0x0b, HDA_INPUT, 0 }, |
| 3905 | { 0x0b, HDA_INPUT, 1 }, |
| 3906 | { 0x0b, HDA_INPUT, 2 }, |
| 3907 | { 0x0b, HDA_INPUT, 3 }, |
| 3908 | { 0x0b, HDA_INPUT, 4 }, |
| 3909 | { } /* end */ |
| 3910 | }; |
| 3911 | |
| 3912 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3913 | { 0x0b, HDA_INPUT, 1 }, |
| 3914 | { 0x0b, HDA_INPUT, 6 }, |
| 3915 | { 0x0b, HDA_INPUT, 7 }, |
| 3916 | { } /* end */ |
| 3917 | }; |
| 3918 | #endif |
| 3919 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3920 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3921 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3922 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3923 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3924 | static int alc_init(struct hda_codec *codec) |
| 3925 | { |
| 3926 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3927 | unsigned int i; |
| 3928 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3929 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3930 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3931 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3932 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3933 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3934 | |
| 3935 | if (spec->init_hook) |
| 3936 | spec->init_hook(codec); |
| 3937 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 3938 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 3939 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3940 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3941 | return 0; |
| 3942 | } |
| 3943 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3944 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3945 | { |
| 3946 | struct alc_spec *spec = codec->spec; |
| 3947 | |
| 3948 | if (spec->unsol_event) |
| 3949 | spec->unsol_event(codec, res); |
| 3950 | } |
| 3951 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3952 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3953 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3954 | { |
| 3955 | struct alc_spec *spec = codec->spec; |
| 3956 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3957 | } |
| 3958 | #endif |
| 3959 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3960 | /* |
| 3961 | * Analog playback callbacks |
| 3962 | */ |
| 3963 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3964 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3965 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3966 | { |
| 3967 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3968 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3969 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3970 | } |
| 3971 | |
| 3972 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3973 | struct hda_codec *codec, |
| 3974 | unsigned int stream_tag, |
| 3975 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3976 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3977 | { |
| 3978 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3979 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3980 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3981 | } |
| 3982 | |
| 3983 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3984 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3985 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3986 | { |
| 3987 | struct alc_spec *spec = codec->spec; |
| 3988 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3989 | } |
| 3990 | |
| 3991 | /* |
| 3992 | * Digital out |
| 3993 | */ |
| 3994 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3995 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3996 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3997 | { |
| 3998 | struct alc_spec *spec = codec->spec; |
| 3999 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 4000 | } |
| 4001 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4002 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4003 | struct hda_codec *codec, |
| 4004 | unsigned int stream_tag, |
| 4005 | unsigned int format, |
| 4006 | struct snd_pcm_substream *substream) |
| 4007 | { |
| 4008 | struct alc_spec *spec = codec->spec; |
| 4009 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 4010 | stream_tag, format, substream); |
| 4011 | } |
| 4012 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4013 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4014 | struct hda_codec *codec, |
| 4015 | struct snd_pcm_substream *substream) |
| 4016 | { |
| 4017 | struct alc_spec *spec = codec->spec; |
| 4018 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 4019 | } |
| 4020 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4021 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 4022 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4023 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4024 | { |
| 4025 | struct alc_spec *spec = codec->spec; |
| 4026 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 4027 | } |
| 4028 | |
| 4029 | /* |
| 4030 | * Analog capture |
| 4031 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4032 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4033 | struct hda_codec *codec, |
| 4034 | unsigned int stream_tag, |
| 4035 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4036 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4037 | { |
| 4038 | struct alc_spec *spec = codec->spec; |
| 4039 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4040 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4041 | stream_tag, 0, format); |
| 4042 | return 0; |
| 4043 | } |
| 4044 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4045 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4046 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4047 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4048 | { |
| 4049 | struct alc_spec *spec = codec->spec; |
| 4050 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 4051 | snd_hda_codec_cleanup_stream(codec, |
| 4052 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4053 | return 0; |
| 4054 | } |
| 4055 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 4056 | /* analog capture with dynamic dual-adc changes */ |
| 4057 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4058 | struct hda_codec *codec, |
| 4059 | unsigned int stream_tag, |
| 4060 | unsigned int format, |
| 4061 | struct snd_pcm_substream *substream) |
| 4062 | { |
| 4063 | struct alc_spec *spec = codec->spec; |
| 4064 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 4065 | spec->cur_adc_stream_tag = stream_tag; |
| 4066 | spec->cur_adc_format = format; |
| 4067 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 4068 | return 0; |
| 4069 | } |
| 4070 | |
| 4071 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4072 | struct hda_codec *codec, |
| 4073 | struct snd_pcm_substream *substream) |
| 4074 | { |
| 4075 | struct alc_spec *spec = codec->spec; |
| 4076 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4077 | spec->cur_adc = 0; |
| 4078 | return 0; |
| 4079 | } |
| 4080 | |
| 4081 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4082 | .substreams = 1, |
| 4083 | .channels_min = 2, |
| 4084 | .channels_max = 2, |
| 4085 | .nid = 0, /* fill later */ |
| 4086 | .ops = { |
| 4087 | .prepare = dualmic_capture_pcm_prepare, |
| 4088 | .cleanup = dualmic_capture_pcm_cleanup |
| 4089 | }, |
| 4090 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4091 | |
| 4092 | /* |
| 4093 | */ |
| 4094 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4095 | .substreams = 1, |
| 4096 | .channels_min = 2, |
| 4097 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4098 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4099 | .ops = { |
| 4100 | .open = alc880_playback_pcm_open, |
| 4101 | .prepare = alc880_playback_pcm_prepare, |
| 4102 | .cleanup = alc880_playback_pcm_cleanup |
| 4103 | }, |
| 4104 | }; |
| 4105 | |
| 4106 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4107 | .substreams = 1, |
| 4108 | .channels_min = 2, |
| 4109 | .channels_max = 2, |
| 4110 | /* NID is set in alc_build_pcms */ |
| 4111 | }; |
| 4112 | |
| 4113 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 4114 | .substreams = 1, |
| 4115 | .channels_min = 2, |
| 4116 | .channels_max = 2, |
| 4117 | /* NID is set in alc_build_pcms */ |
| 4118 | }; |
| 4119 | |
| 4120 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 4121 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4122 | .channels_min = 2, |
| 4123 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4124 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4125 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4126 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4127 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4128 | }, |
| 4129 | }; |
| 4130 | |
| 4131 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4132 | .substreams = 1, |
| 4133 | .channels_min = 2, |
| 4134 | .channels_max = 2, |
| 4135 | /* NID is set in alc_build_pcms */ |
| 4136 | .ops = { |
| 4137 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4138 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4139 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4140 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4141 | }, |
| 4142 | }; |
| 4143 | |
| 4144 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4145 | .substreams = 1, |
| 4146 | .channels_min = 2, |
| 4147 | .channels_max = 2, |
| 4148 | /* NID is set in alc_build_pcms */ |
| 4149 | }; |
| 4150 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4151 | /* 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] | 4152 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4153 | .substreams = 0, |
| 4154 | .channels_min = 0, |
| 4155 | .channels_max = 0, |
| 4156 | }; |
| 4157 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4158 | static int alc_build_pcms(struct hda_codec *codec) |
| 4159 | { |
| 4160 | struct alc_spec *spec = codec->spec; |
| 4161 | struct hda_pcm *info = spec->pcm_rec; |
| 4162 | int i; |
| 4163 | |
| 4164 | codec->num_pcms = 1; |
| 4165 | codec->pcm_info = info; |
| 4166 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4167 | if (spec->no_analog) |
| 4168 | goto skip_analog; |
| 4169 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4170 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4171 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4172 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4173 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4174 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4175 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4176 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4177 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4178 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4179 | } |
| 4180 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4181 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4182 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4183 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4184 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4185 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4186 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4187 | if (spec->channel_mode) { |
| 4188 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4189 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4190 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4191 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4192 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4193 | } |
| 4194 | } |
| 4195 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4196 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4197 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4198 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4199 | snprintf(spec->stream_name_digital, |
| 4200 | sizeof(spec->stream_name_digital), |
| 4201 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4202 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4203 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4204 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4205 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4206 | if (spec->dig_out_type) |
| 4207 | info->pcm_type = spec->dig_out_type; |
| 4208 | else |
| 4209 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4210 | if (spec->multiout.dig_out_nid && |
| 4211 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4212 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4213 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4214 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4215 | if (spec->dig_in_nid && |
| 4216 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4217 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4218 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4219 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4220 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4221 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4222 | } |
| 4223 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4224 | if (spec->no_analog) |
| 4225 | return 0; |
| 4226 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4227 | /* If the use of more than one ADC is requested for the current |
| 4228 | * model, configure a second analog capture-only PCM. |
| 4229 | */ |
| 4230 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4231 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4232 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4233 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4234 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4235 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4236 | if (spec->alt_dac_nid) { |
| 4237 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4238 | *spec->stream_analog_alt_playback; |
| 4239 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4240 | spec->alt_dac_nid; |
| 4241 | } else { |
| 4242 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4243 | alc_pcm_null_stream; |
| 4244 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4245 | } |
| 4246 | if (spec->num_adc_nids > 1) { |
| 4247 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4248 | *spec->stream_analog_alt_capture; |
| 4249 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4250 | spec->adc_nids[1]; |
| 4251 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4252 | spec->num_adc_nids - 1; |
| 4253 | } else { |
| 4254 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4255 | alc_pcm_null_stream; |
| 4256 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4257 | } |
| 4258 | } |
| 4259 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4260 | return 0; |
| 4261 | } |
| 4262 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4263 | static inline void alc_shutup(struct hda_codec *codec) |
| 4264 | { |
| 4265 | snd_hda_shutup_pins(codec); |
| 4266 | } |
| 4267 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4268 | static void alc_free_kctls(struct hda_codec *codec) |
| 4269 | { |
| 4270 | struct alc_spec *spec = codec->spec; |
| 4271 | |
| 4272 | if (spec->kctls.list) { |
| 4273 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4274 | int i; |
| 4275 | for (i = 0; i < spec->kctls.used; i++) |
| 4276 | kfree(kctl[i].name); |
| 4277 | } |
| 4278 | snd_array_free(&spec->kctls); |
| 4279 | } |
| 4280 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4281 | static void alc_free(struct hda_codec *codec) |
| 4282 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4283 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4284 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4285 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4286 | return; |
| 4287 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4288 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4289 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4290 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4291 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4292 | } |
| 4293 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4294 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4295 | static void alc_power_eapd(struct hda_codec *codec) |
| 4296 | { |
| 4297 | /* We currently only handle front, HP */ |
| 4298 | switch (codec->vendor_id) { |
| 4299 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4300 | set_eapd(codec, 0x0f, 0); |
| 4301 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4302 | break; |
| 4303 | case 0x10ec0262: |
| 4304 | case 0x10ec0267: |
| 4305 | case 0x10ec0268: |
| 4306 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4307 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4308 | case 0x10ec0272: |
| 4309 | case 0x10ec0660: |
| 4310 | case 0x10ec0662: |
| 4311 | case 0x10ec0663: |
| 4312 | case 0x10ec0862: |
| 4313 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4314 | set_eapd(codec, 0x14, 0); |
| 4315 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4316 | break; |
| 4317 | } |
| 4318 | } |
| 4319 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4320 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4321 | { |
| 4322 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4323 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4324 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4325 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4326 | return 0; |
| 4327 | } |
| 4328 | #endif |
| 4329 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4330 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4331 | static int alc_resume(struct hda_codec *codec) |
| 4332 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4333 | codec->patch_ops.init(codec); |
| 4334 | snd_hda_codec_resume_amp(codec); |
| 4335 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4336 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4337 | return 0; |
| 4338 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4339 | #endif |
| 4340 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4341 | /* |
| 4342 | */ |
| 4343 | static struct hda_codec_ops alc_patch_ops = { |
| 4344 | .build_controls = alc_build_controls, |
| 4345 | .build_pcms = alc_build_pcms, |
| 4346 | .init = alc_init, |
| 4347 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4348 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4349 | #ifdef SND_HDA_NEEDS_RESUME |
| 4350 | .resume = alc_resume, |
| 4351 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4352 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4353 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4354 | .check_power_status = alc_check_power_status, |
| 4355 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4356 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4357 | }; |
| 4358 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4359 | /* replace the codec chip_name with the given string */ |
| 4360 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4361 | { |
| 4362 | kfree(codec->chip_name); |
| 4363 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4364 | if (!codec->chip_name) { |
| 4365 | alc_free(codec); |
| 4366 | return -ENOMEM; |
| 4367 | } |
| 4368 | return 0; |
| 4369 | } |
| 4370 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4371 | /* |
| 4372 | * Test configuration for debugging |
| 4373 | * |
| 4374 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4375 | * enum controls. |
| 4376 | */ |
| 4377 | #ifdef CONFIG_SND_DEBUG |
| 4378 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4379 | 0x02, 0x03, 0x04, 0x05 |
| 4380 | }; |
| 4381 | |
| 4382 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4383 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4384 | .items = { |
| 4385 | { "In-1", 0x0 }, |
| 4386 | { "In-2", 0x1 }, |
| 4387 | { "In-3", 0x2 }, |
| 4388 | { "In-4", 0x3 }, |
| 4389 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4390 | { "Front", 0x5 }, |
| 4391 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4392 | }, |
| 4393 | }; |
| 4394 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4395 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4396 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4397 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4398 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4399 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4400 | }; |
| 4401 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4402 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4403 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4404 | { |
| 4405 | static char *texts[] = { |
| 4406 | "N/A", "Line Out", "HP Out", |
| 4407 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4408 | }; |
| 4409 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4410 | uinfo->count = 1; |
| 4411 | uinfo->value.enumerated.items = 8; |
| 4412 | if (uinfo->value.enumerated.item >= 8) |
| 4413 | uinfo->value.enumerated.item = 7; |
| 4414 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4415 | return 0; |
| 4416 | } |
| 4417 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4418 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4419 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4420 | { |
| 4421 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4422 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4423 | unsigned int pin_ctl, item = 0; |
| 4424 | |
| 4425 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4426 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4427 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4428 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4429 | item = 2; |
| 4430 | else |
| 4431 | item = 1; |
| 4432 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4433 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4434 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4435 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4436 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4437 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4438 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4439 | } |
| 4440 | } |
| 4441 | ucontrol->value.enumerated.item[0] = item; |
| 4442 | return 0; |
| 4443 | } |
| 4444 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4445 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4446 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4447 | { |
| 4448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4449 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4450 | static unsigned int ctls[] = { |
| 4451 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4452 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4453 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4454 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4455 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4456 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4457 | }; |
| 4458 | unsigned int old_ctl, new_ctl; |
| 4459 | |
| 4460 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4461 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4462 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4463 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4464 | int val; |
| 4465 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4466 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4467 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4468 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4469 | HDA_AMP_MUTE : 0; |
| 4470 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4471 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4472 | return 1; |
| 4473 | } |
| 4474 | return 0; |
| 4475 | } |
| 4476 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4477 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4478 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4479 | { |
| 4480 | static char *texts[] = { |
| 4481 | "Front", "Surround", "CLFE", "Side" |
| 4482 | }; |
| 4483 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4484 | uinfo->count = 1; |
| 4485 | uinfo->value.enumerated.items = 4; |
| 4486 | if (uinfo->value.enumerated.item >= 4) |
| 4487 | uinfo->value.enumerated.item = 3; |
| 4488 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4489 | return 0; |
| 4490 | } |
| 4491 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4492 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4493 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4494 | { |
| 4495 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4496 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4497 | unsigned int sel; |
| 4498 | |
| 4499 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4500 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4501 | return 0; |
| 4502 | } |
| 4503 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4504 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4505 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4506 | { |
| 4507 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4508 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4509 | unsigned int sel; |
| 4510 | |
| 4511 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4512 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4513 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4514 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4515 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4516 | return 1; |
| 4517 | } |
| 4518 | return 0; |
| 4519 | } |
| 4520 | |
| 4521 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4522 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4523 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4524 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4525 | .info = alc_test_pin_ctl_info, \ |
| 4526 | .get = alc_test_pin_ctl_get, \ |
| 4527 | .put = alc_test_pin_ctl_put, \ |
| 4528 | .private_value = nid \ |
| 4529 | } |
| 4530 | |
| 4531 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4532 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4533 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4534 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4535 | .info = alc_test_pin_src_info, \ |
| 4536 | .get = alc_test_pin_src_get, \ |
| 4537 | .put = alc_test_pin_src_put, \ |
| 4538 | .private_value = nid \ |
| 4539 | } |
| 4540 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4541 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4542 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4543 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4544 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4545 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4546 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4547 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4548 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4549 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4550 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4551 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4552 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4553 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4554 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4555 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4556 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4557 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4558 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4559 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4560 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4561 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4562 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4563 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4564 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4565 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4566 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4567 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4568 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4569 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4570 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4571 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4572 | { |
| 4573 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4574 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4575 | .info = alc_ch_mode_info, |
| 4576 | .get = alc_ch_mode_get, |
| 4577 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4578 | }, |
| 4579 | { } /* end */ |
| 4580 | }; |
| 4581 | |
| 4582 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4583 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4584 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4588 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4589 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4590 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4591 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4592 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4594 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4595 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4596 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4597 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4598 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4599 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4600 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4601 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4602 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4603 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4604 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4605 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4606 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4607 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4608 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4609 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4610 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4611 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4612 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4613 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4614 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4615 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4616 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4617 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4618 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4619 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4620 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4621 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4622 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4623 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4624 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4625 | /* Analog input/passthru */ |
| 4626 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4627 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4628 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4629 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4630 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4631 | { } |
| 4632 | }; |
| 4633 | #endif |
| 4634 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4635 | /* |
| 4636 | */ |
| 4637 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 4638 | static const char * const alc880_models[ALC880_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4639 | [ALC880_3ST] = "3stack", |
| 4640 | [ALC880_TCL_S700] = "tcl", |
| 4641 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4642 | [ALC880_CLEVO] = "clevo", |
| 4643 | [ALC880_5ST] = "5stack", |
| 4644 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4645 | [ALC880_W810] = "w810", |
| 4646 | [ALC880_Z71V] = "z71v", |
| 4647 | [ALC880_6ST] = "6stack", |
| 4648 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4649 | [ALC880_ASUS] = "asus", |
| 4650 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4651 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4652 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4653 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4654 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4655 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4656 | [ALC880_F1734] = "F1734", |
| 4657 | [ALC880_LG] = "lg", |
| 4658 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4659 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4660 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4661 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4662 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4663 | [ALC880_AUTO] = "auto", |
| 4664 | }; |
| 4665 | |
| 4666 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4667 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4668 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4669 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4670 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4671 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4672 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4673 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4674 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4675 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4676 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4677 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4678 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4679 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4680 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4681 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4682 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4683 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4684 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4685 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4686 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4687 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4688 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4689 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4690 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4691 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4692 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4693 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4694 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4695 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4696 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4697 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4698 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4699 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4700 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4701 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4702 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4703 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4704 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4705 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4706 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4707 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4708 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4709 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4710 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4711 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4712 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4713 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4714 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4715 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4716 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4717 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4718 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4719 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4720 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4721 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4722 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4723 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4724 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4725 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4726 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4727 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4728 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4729 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4730 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4731 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4732 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4733 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4734 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4735 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4736 | /* default Intel */ |
| 4737 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4738 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4739 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4740 | {} |
| 4741 | }; |
| 4742 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4743 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4744 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4745 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4746 | static struct alc_config_preset alc880_presets[] = { |
| 4747 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4748 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4749 | .init_verbs = { alc880_volume_init_verbs, |
| 4750 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4751 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4752 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4753 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4754 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4755 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4756 | .input_mux = &alc880_capture_source, |
| 4757 | }, |
| 4758 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4759 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4760 | .init_verbs = { alc880_volume_init_verbs, |
| 4761 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4762 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4763 | .dac_nids = alc880_dac_nids, |
| 4764 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4765 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4766 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4767 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4768 | .input_mux = &alc880_capture_source, |
| 4769 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4770 | [ALC880_TCL_S700] = { |
| 4771 | .mixers = { alc880_tcl_s700_mixer }, |
| 4772 | .init_verbs = { alc880_volume_init_verbs, |
| 4773 | alc880_pin_tcl_S700_init_verbs, |
| 4774 | alc880_gpio2_init_verbs }, |
| 4775 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4776 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4777 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4778 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4779 | .hp_nid = 0x03, |
| 4780 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4781 | .channel_mode = alc880_2_jack_modes, |
| 4782 | .input_mux = &alc880_capture_source, |
| 4783 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4784 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4785 | .mixers = { alc880_three_stack_mixer, |
| 4786 | alc880_five_stack_mixer}, |
| 4787 | .init_verbs = { alc880_volume_init_verbs, |
| 4788 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4789 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4790 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4791 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4792 | .channel_mode = alc880_fivestack_modes, |
| 4793 | .input_mux = &alc880_capture_source, |
| 4794 | }, |
| 4795 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4796 | .mixers = { alc880_three_stack_mixer, |
| 4797 | alc880_five_stack_mixer }, |
| 4798 | .init_verbs = { alc880_volume_init_verbs, |
| 4799 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4800 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4801 | .dac_nids = alc880_dac_nids, |
| 4802 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4803 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4804 | .channel_mode = alc880_fivestack_modes, |
| 4805 | .input_mux = &alc880_capture_source, |
| 4806 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4807 | [ALC880_6ST] = { |
| 4808 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4809 | .init_verbs = { alc880_volume_init_verbs, |
| 4810 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4811 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4812 | .dac_nids = alc880_6st_dac_nids, |
| 4813 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4814 | .channel_mode = alc880_sixstack_modes, |
| 4815 | .input_mux = &alc880_6stack_capture_source, |
| 4816 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4817 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4818 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4819 | .init_verbs = { alc880_volume_init_verbs, |
| 4820 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4821 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4822 | .dac_nids = alc880_6st_dac_nids, |
| 4823 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4824 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4825 | .channel_mode = alc880_sixstack_modes, |
| 4826 | .input_mux = &alc880_6stack_capture_source, |
| 4827 | }, |
| 4828 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4829 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4830 | .init_verbs = { alc880_volume_init_verbs, |
| 4831 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4832 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4833 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4834 | .dac_nids = alc880_w810_dac_nids, |
| 4835 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4836 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4837 | .channel_mode = alc880_w810_modes, |
| 4838 | .input_mux = &alc880_capture_source, |
| 4839 | }, |
| 4840 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4841 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4842 | .init_verbs = { alc880_volume_init_verbs, |
| 4843 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4844 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4845 | .dac_nids = alc880_z71v_dac_nids, |
| 4846 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4847 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4848 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4849 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4850 | .input_mux = &alc880_capture_source, |
| 4851 | }, |
| 4852 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4853 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4854 | .init_verbs = { alc880_volume_init_verbs, |
| 4855 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4856 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4857 | .dac_nids = alc880_f1734_dac_nids, |
| 4858 | .hp_nid = 0x02, |
| 4859 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4860 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4861 | .input_mux = &alc880_f1734_capture_source, |
| 4862 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4863 | .setup = alc880_uniwill_p53_setup, |
| 4864 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4865 | }, |
| 4866 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4867 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4868 | .init_verbs = { alc880_volume_init_verbs, |
| 4869 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4870 | alc880_gpio1_init_verbs }, |
| 4871 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4872 | .dac_nids = alc880_asus_dac_nids, |
| 4873 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4874 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4875 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4876 | .input_mux = &alc880_capture_source, |
| 4877 | }, |
| 4878 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4879 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4880 | .init_verbs = { alc880_volume_init_verbs, |
| 4881 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4882 | alc880_gpio1_init_verbs }, |
| 4883 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4884 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4885 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4886 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4887 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4888 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4889 | .input_mux = &alc880_capture_source, |
| 4890 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4891 | [ALC880_ASUS_DIG2] = { |
| 4892 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4893 | .init_verbs = { alc880_volume_init_verbs, |
| 4894 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4895 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4896 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4897 | .dac_nids = alc880_asus_dac_nids, |
| 4898 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4899 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4900 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4901 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4902 | .input_mux = &alc880_capture_source, |
| 4903 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4904 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4905 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4906 | .init_verbs = { alc880_volume_init_verbs, |
| 4907 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4908 | alc880_gpio1_init_verbs }, |
| 4909 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4910 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4911 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4912 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4913 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4914 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4915 | .input_mux = &alc880_capture_source, |
| 4916 | }, |
| 4917 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4918 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4919 | .init_verbs = { alc880_volume_init_verbs, |
| 4920 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4921 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4922 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4923 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4924 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4925 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4926 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4927 | .input_mux = &alc880_capture_source, |
| 4928 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4929 | [ALC880_UNIWILL] = { |
| 4930 | .mixers = { alc880_uniwill_mixer }, |
| 4931 | .init_verbs = { alc880_volume_init_verbs, |
| 4932 | alc880_uniwill_init_verbs }, |
| 4933 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4934 | .dac_nids = alc880_asus_dac_nids, |
| 4935 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4936 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4937 | .channel_mode = alc880_threestack_modes, |
| 4938 | .need_dac_fix = 1, |
| 4939 | .input_mux = &alc880_capture_source, |
| 4940 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4941 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4942 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4943 | }, |
| 4944 | [ALC880_UNIWILL_P53] = { |
| 4945 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4946 | .init_verbs = { alc880_volume_init_verbs, |
| 4947 | alc880_uniwill_p53_init_verbs }, |
| 4948 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4949 | .dac_nids = alc880_asus_dac_nids, |
| 4950 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4951 | .channel_mode = alc880_threestack_modes, |
| 4952 | .input_mux = &alc880_capture_source, |
| 4953 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4954 | .setup = alc880_uniwill_p53_setup, |
| 4955 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4956 | }, |
| 4957 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4958 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4959 | .init_verbs = { alc880_volume_init_verbs, |
| 4960 | alc880_uniwill_p53_init_verbs, |
| 4961 | alc880_beep_init_verbs }, |
| 4962 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4963 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4964 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4965 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4966 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4967 | .input_mux = &alc880_capture_source, |
| 4968 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4969 | .setup = alc880_uniwill_p53_setup, |
| 4970 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4971 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4972 | [ALC880_CLEVO] = { |
| 4973 | .mixers = { alc880_three_stack_mixer }, |
| 4974 | .init_verbs = { alc880_volume_init_verbs, |
| 4975 | alc880_pin_clevo_init_verbs }, |
| 4976 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4977 | .dac_nids = alc880_dac_nids, |
| 4978 | .hp_nid = 0x03, |
| 4979 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4980 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4981 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4982 | .input_mux = &alc880_capture_source, |
| 4983 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4984 | [ALC880_LG] = { |
| 4985 | .mixers = { alc880_lg_mixer }, |
| 4986 | .init_verbs = { alc880_volume_init_verbs, |
| 4987 | alc880_lg_init_verbs }, |
| 4988 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4989 | .dac_nids = alc880_lg_dac_nids, |
| 4990 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4991 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4992 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4993 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4994 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4995 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4996 | .setup = alc880_lg_setup, |
| 4997 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4998 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4999 | .loopbacks = alc880_lg_loopbacks, |
| 5000 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5001 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5002 | [ALC880_LG_LW] = { |
| 5003 | .mixers = { alc880_lg_lw_mixer }, |
| 5004 | .init_verbs = { alc880_volume_init_verbs, |
| 5005 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5006 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5007 | .dac_nids = alc880_dac_nids, |
| 5008 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5009 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 5010 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5011 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 5012 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5013 | .setup = alc880_lg_lw_setup, |
| 5014 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5015 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5016 | [ALC880_MEDION_RIM] = { |
| 5017 | .mixers = { alc880_medion_rim_mixer }, |
| 5018 | .init_verbs = { alc880_volume_init_verbs, |
| 5019 | alc880_medion_rim_init_verbs, |
| 5020 | alc_gpio2_init_verbs }, |
| 5021 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5022 | .dac_nids = alc880_dac_nids, |
| 5023 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5024 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5025 | .channel_mode = alc880_2_jack_modes, |
| 5026 | .input_mux = &alc880_medion_rim_capture_source, |
| 5027 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5028 | .setup = alc880_medion_rim_setup, |
| 5029 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5030 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5031 | #ifdef CONFIG_SND_DEBUG |
| 5032 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5033 | .mixers = { alc880_test_mixer }, |
| 5034 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5035 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 5036 | .dac_nids = alc880_test_dac_nids, |
| 5037 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5038 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 5039 | .channel_mode = alc880_test_modes, |
| 5040 | .input_mux = &alc880_test_capture_source, |
| 5041 | }, |
| 5042 | #endif |
| 5043 | }; |
| 5044 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5045 | /* |
| 5046 | * Automatic parse of I/O pins from the BIOS configuration |
| 5047 | */ |
| 5048 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5049 | enum { |
| 5050 | ALC_CTL_WIDGET_VOL, |
| 5051 | ALC_CTL_WIDGET_MUTE, |
| 5052 | ALC_CTL_BIND_MUTE, |
| 5053 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5054 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5055 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 5056 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5057 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5058 | }; |
| 5059 | |
| 5060 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5061 | static int add_control(struct alc_spec *spec, int type, const char *name, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5062 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5063 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5064 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5065 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5066 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 5067 | knew = snd_array_new(&spec->kctls); |
| 5068 | if (!knew) |
| 5069 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5070 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5071 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5072 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5073 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5074 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5075 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5076 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5077 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5078 | return 0; |
| 5079 | } |
| 5080 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5081 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5082 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5083 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5084 | { |
| 5085 | char name[32]; |
| 5086 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5087 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5088 | } |
| 5089 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5090 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5091 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5092 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5093 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5094 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5095 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5096 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5097 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5098 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5099 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5100 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5101 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5102 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5103 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5104 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5105 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5106 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5107 | #define ALC880_PIN_CD_NID 0x1c |
| 5108 | |
| 5109 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5110 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5111 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5112 | { |
| 5113 | hda_nid_t nid; |
| 5114 | int assigned[4]; |
| 5115 | int i, j; |
| 5116 | |
| 5117 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5118 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5119 | |
| 5120 | /* check the pins hardwired to audio widget */ |
| 5121 | for (i = 0; i < cfg->line_outs; i++) { |
| 5122 | nid = cfg->line_out_pins[i]; |
| 5123 | if (alc880_is_fixed_pin(nid)) { |
| 5124 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5125 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5126 | assigned[idx] = 1; |
| 5127 | } |
| 5128 | } |
| 5129 | /* left pins can be connect to any audio widget */ |
| 5130 | for (i = 0; i < cfg->line_outs; i++) { |
| 5131 | nid = cfg->line_out_pins[i]; |
| 5132 | if (alc880_is_fixed_pin(nid)) |
| 5133 | continue; |
| 5134 | /* search for an empty channel */ |
| 5135 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5136 | if (!assigned[j]) { |
| 5137 | spec->multiout.dac_nids[i] = |
| 5138 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5139 | assigned[j] = 1; |
| 5140 | break; |
| 5141 | } |
| 5142 | } |
| 5143 | } |
| 5144 | spec->multiout.num_dacs = cfg->line_outs; |
| 5145 | return 0; |
| 5146 | } |
| 5147 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5148 | static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg, |
| 5149 | bool can_be_master) |
| 5150 | { |
| 5151 | if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
| 5152 | return "Master"; |
| 5153 | |
| 5154 | switch (cfg->line_out_type) { |
| 5155 | case AUTO_PIN_SPEAKER_OUT: |
| 5156 | return "Speaker"; |
| 5157 | case AUTO_PIN_HP_OUT: |
| 5158 | return "Headphone"; |
| 5159 | default: |
| 5160 | if (cfg->line_outs == 1) |
| 5161 | return "PCM"; |
| 5162 | break; |
| 5163 | } |
| 5164 | return NULL; |
| 5165 | } |
| 5166 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5167 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5168 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5169 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5170 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 5171 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5172 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5173 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5174 | const char *pfx = alc_get_line_out_pfx(cfg, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5175 | hda_nid_t nid; |
| 5176 | int i, err; |
| 5177 | |
| 5178 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5179 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5180 | continue; |
| 5181 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5182 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5183 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5184 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5185 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5186 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5187 | HDA_OUTPUT)); |
| 5188 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5189 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5190 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5191 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5192 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5193 | HDA_OUTPUT)); |
| 5194 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5195 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5196 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5197 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5198 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5199 | HDA_INPUT)); |
| 5200 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5201 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5202 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5203 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5204 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5205 | HDA_INPUT)); |
| 5206 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5207 | return err; |
| 5208 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5209 | const char *name = pfx; |
| 5210 | if (!name) |
| 5211 | name = chname[i]; |
| 5212 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5213 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5214 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5215 | HDA_OUTPUT)); |
| 5216 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5217 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5218 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5219 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5220 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5221 | HDA_INPUT)); |
| 5222 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5223 | return err; |
| 5224 | } |
| 5225 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5226 | return 0; |
| 5227 | } |
| 5228 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5229 | /* add playback controls for speaker and HP outputs */ |
| 5230 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5231 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5232 | { |
| 5233 | hda_nid_t nid; |
| 5234 | int err; |
| 5235 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5236 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5237 | return 0; |
| 5238 | |
| 5239 | if (alc880_is_fixed_pin(pin)) { |
| 5240 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5241 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5242 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5243 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5244 | else |
| 5245 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5246 | /* control HP volume/switch on the output mixer amp */ |
| 5247 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5248 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5249 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5250 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5251 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5252 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5253 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5254 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5255 | return err; |
| 5256 | } else if (alc880_is_multi_pin(pin)) { |
| 5257 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5258 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5259 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5260 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5261 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5262 | return err; |
| 5263 | } |
| 5264 | return 0; |
| 5265 | } |
| 5266 | |
| 5267 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5268 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5269 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5270 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5271 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5272 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5273 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5274 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5275 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5276 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5277 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5278 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5279 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5280 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5281 | return err; |
| 5282 | return 0; |
| 5283 | } |
| 5284 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5285 | 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] | 5286 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5287 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5288 | return (pincap & AC_PINCAP_IN) != 0; |
| 5289 | } |
| 5290 | |
| 5291 | /* create playback/capture controls for input pins */ |
| 5292 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5293 | const struct auto_pin_cfg *cfg, |
| 5294 | hda_nid_t mixer, |
| 5295 | hda_nid_t cap1, hda_nid_t cap2) |
| 5296 | { |
| 5297 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5298 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5299 | int i, err, idx, type_idx = 0; |
| 5300 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5301 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5302 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5303 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5304 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5305 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5306 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5307 | if (!alc_is_input_pin(codec, pin)) |
| 5308 | continue; |
| 5309 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5310 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5311 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5312 | type_idx++; |
| 5313 | else |
| 5314 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5315 | prev_label = label; |
| 5316 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5317 | if (mixer) { |
| 5318 | idx = get_connection_index(codec, mixer, pin); |
| 5319 | if (idx >= 0) { |
| 5320 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5321 | label, type_idx, |
| 5322 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5323 | if (err < 0) |
| 5324 | return err; |
| 5325 | } |
| 5326 | } |
| 5327 | |
| 5328 | if (!cap1) |
| 5329 | continue; |
| 5330 | idx = get_connection_index(codec, cap1, pin); |
| 5331 | if (idx < 0 && cap2) |
| 5332 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5333 | if (idx >= 0) |
| 5334 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5335 | } |
| 5336 | return 0; |
| 5337 | } |
| 5338 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5339 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5340 | const struct auto_pin_cfg *cfg) |
| 5341 | { |
| 5342 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5343 | } |
| 5344 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5345 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5346 | unsigned int pin_type) |
| 5347 | { |
| 5348 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5349 | pin_type); |
| 5350 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5351 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5352 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5353 | } |
| 5354 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5355 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5356 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5357 | int dac_idx) |
| 5358 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5359 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5360 | /* need the manual connection? */ |
| 5361 | if (alc880_is_multi_pin(nid)) { |
| 5362 | struct alc_spec *spec = codec->spec; |
| 5363 | int idx = alc880_multi_pin_idx(nid); |
| 5364 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5365 | AC_VERB_SET_CONNECT_SEL, |
| 5366 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5367 | } |
| 5368 | } |
| 5369 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5370 | static int get_pin_type(int line_out_type) |
| 5371 | { |
| 5372 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5373 | return PIN_HP; |
| 5374 | else |
| 5375 | return PIN_OUT; |
| 5376 | } |
| 5377 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5378 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5379 | { |
| 5380 | struct alc_spec *spec = codec->spec; |
| 5381 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5382 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5383 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5384 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5385 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5386 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5387 | } |
| 5388 | } |
| 5389 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5390 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5391 | { |
| 5392 | struct alc_spec *spec = codec->spec; |
| 5393 | hda_nid_t pin; |
| 5394 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5395 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5396 | if (pin) /* connect to front */ |
| 5397 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5398 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5399 | if (pin) /* connect to front */ |
| 5400 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5401 | } |
| 5402 | |
| 5403 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5404 | { |
| 5405 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5406 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5407 | int i; |
| 5408 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5409 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5410 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5411 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5412 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5413 | if (nid != ALC880_PIN_CD_NID && |
| 5414 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5415 | snd_hda_codec_write(codec, nid, 0, |
| 5416 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5417 | AMP_OUT_MUTE); |
| 5418 | } |
| 5419 | } |
| 5420 | } |
| 5421 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5422 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5423 | { |
| 5424 | struct alc_spec *spec = codec->spec; |
| 5425 | int c; |
| 5426 | |
| 5427 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5428 | unsigned int mux_idx; |
| 5429 | const struct hda_input_mux *imux; |
| 5430 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5431 | imux = &spec->input_mux[mux_idx]; |
| 5432 | if (!imux->num_items && mux_idx > 0) |
| 5433 | imux = &spec->input_mux[0]; |
| 5434 | if (imux) |
| 5435 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5436 | AC_VERB_SET_CONNECT_SEL, |
| 5437 | imux->items[0].index); |
| 5438 | } |
| 5439 | } |
| 5440 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5441 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5442 | /* return 1 if successful, 0 if the proper config is not found, |
| 5443 | * or a negative error code |
| 5444 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5445 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5446 | { |
| 5447 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5448 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5449 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5450 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5451 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5452 | alc880_ignore); |
| 5453 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5454 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5455 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5456 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5457 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5458 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5459 | if (err < 0) |
| 5460 | return err; |
| 5461 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5462 | if (err < 0) |
| 5463 | return err; |
| 5464 | err = alc880_auto_create_extra_out(spec, |
| 5465 | spec->autocfg.speaker_pins[0], |
| 5466 | "Speaker"); |
| 5467 | if (err < 0) |
| 5468 | return err; |
| 5469 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5470 | "Headphone"); |
| 5471 | if (err < 0) |
| 5472 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5473 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5474 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5475 | return err; |
| 5476 | |
| 5477 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5478 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5479 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5480 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5481 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5482 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5483 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5484 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5485 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5486 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5487 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5488 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5489 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5490 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5491 | return 1; |
| 5492 | } |
| 5493 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5494 | /* additional initialization for auto-configuration model */ |
| 5495 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5496 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5497 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5498 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5499 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5500 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5501 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5502 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5503 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5504 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5505 | } |
| 5506 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5507 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5508 | * one of two digital mic pins, e.g. on ALC272 |
| 5509 | */ |
| 5510 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5511 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5512 | struct alc_spec *spec = codec->spec; |
| 5513 | int i; |
| 5514 | |
| 5515 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5516 | hda_nid_t cap = spec->capsrc_nids ? |
| 5517 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5518 | int iidx, eidx; |
| 5519 | |
| 5520 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5521 | if (iidx < 0) |
| 5522 | continue; |
| 5523 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5524 | if (eidx < 0) |
| 5525 | continue; |
| 5526 | spec->int_mic.mux_idx = iidx; |
| 5527 | spec->ext_mic.mux_idx = eidx; |
| 5528 | if (spec->capsrc_nids) |
| 5529 | spec->capsrc_nids += i; |
| 5530 | spec->adc_nids += i; |
| 5531 | spec->num_adc_nids = 1; |
| 5532 | return; |
| 5533 | } |
| 5534 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5535 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5536 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5537 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5538 | } |
| 5539 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5540 | /* select or unmute the given capsrc route */ |
| 5541 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5542 | int idx) |
| 5543 | { |
| 5544 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5545 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5546 | HDA_AMP_MUTE, 0); |
| 5547 | } else { |
| 5548 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5549 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5550 | } |
| 5551 | } |
| 5552 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5553 | /* set the default connection to that pin */ |
| 5554 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5555 | { |
| 5556 | struct alc_spec *spec = codec->spec; |
| 5557 | int i; |
| 5558 | |
| 5559 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5560 | hda_nid_t cap = spec->capsrc_nids ? |
| 5561 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5562 | int idx; |
| 5563 | |
| 5564 | idx = get_connection_index(codec, cap, pin); |
| 5565 | if (idx < 0) |
| 5566 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5567 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5568 | return i; /* return the found index */ |
| 5569 | } |
| 5570 | return -1; /* not found */ |
| 5571 | } |
| 5572 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5573 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5574 | static void fixup_single_adc(struct hda_codec *codec) |
| 5575 | { |
| 5576 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5577 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5578 | int i; |
| 5579 | |
| 5580 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5581 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5582 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5583 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5584 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5585 | /* use only this ADC */ |
| 5586 | if (spec->capsrc_nids) |
| 5587 | spec->capsrc_nids += i; |
| 5588 | spec->adc_nids += i; |
| 5589 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5590 | } |
| 5591 | } |
| 5592 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5593 | /* initialize dual adcs */ |
| 5594 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5595 | { |
| 5596 | struct alc_spec *spec = codec->spec; |
| 5597 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5598 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5599 | } |
| 5600 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5601 | static void set_capture_mixer(struct hda_codec *codec) |
| 5602 | { |
| 5603 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5604 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5605 | { alc_capture_mixer_nosrc1, |
| 5606 | alc_capture_mixer_nosrc2, |
| 5607 | alc_capture_mixer_nosrc3 }, |
| 5608 | { alc_capture_mixer1, |
| 5609 | alc_capture_mixer2, |
| 5610 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5611 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5612 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5613 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5614 | int num_adcs = spec->num_adc_nids; |
| 5615 | if (spec->dual_adc_switch) |
| 5616 | fixup_dual_adc_switch(codec); |
| 5617 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5618 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5619 | else if (spec->input_mux) { |
| 5620 | if (spec->input_mux->num_items > 1) |
| 5621 | mux = 1; |
| 5622 | else if (spec->input_mux->num_items == 1) |
| 5623 | fixup_single_adc(codec); |
| 5624 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5625 | if (spec->dual_adc_switch) |
| 5626 | num_adcs = 1; |
| 5627 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5628 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5629 | } |
| 5630 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5631 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5632 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5633 | int num_nids) |
| 5634 | { |
| 5635 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5636 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5637 | int n; |
| 5638 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5639 | |
| 5640 | for (n = 0; n < num_nids; n++) { |
| 5641 | hda_nid_t adc, cap; |
| 5642 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5643 | int nconns, i, j; |
| 5644 | |
| 5645 | adc = nids[n]; |
| 5646 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5647 | continue; |
| 5648 | cap = adc; |
| 5649 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5650 | ARRAY_SIZE(conn)); |
| 5651 | if (nconns == 1) { |
| 5652 | cap = conn[0]; |
| 5653 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5654 | ARRAY_SIZE(conn)); |
| 5655 | } |
| 5656 | if (nconns <= 0) |
| 5657 | continue; |
| 5658 | if (!fallback_adc) { |
| 5659 | fallback_adc = adc; |
| 5660 | fallback_cap = cap; |
| 5661 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5662 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5663 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5664 | for (j = 0; j < nconns; j++) { |
| 5665 | if (conn[j] == nid) |
| 5666 | break; |
| 5667 | } |
| 5668 | if (j >= nconns) |
| 5669 | break; |
| 5670 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5671 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5672 | int num_adcs = spec->num_adc_nids; |
| 5673 | spec->private_adc_nids[num_adcs] = adc; |
| 5674 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5675 | spec->num_adc_nids++; |
| 5676 | spec->adc_nids = spec->private_adc_nids; |
| 5677 | if (adc != cap) |
| 5678 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5679 | } |
| 5680 | } |
| 5681 | if (!spec->num_adc_nids) { |
| 5682 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5683 | " using fallback 0x%x\n", |
| 5684 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5685 | spec->private_adc_nids[0] = fallback_adc; |
| 5686 | spec->adc_nids = spec->private_adc_nids; |
| 5687 | if (fallback_adc != fallback_cap) { |
| 5688 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5689 | spec->capsrc_nids = spec->private_adc_nids; |
| 5690 | } |
| 5691 | } |
| 5692 | } |
| 5693 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5694 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5695 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5696 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5697 | |
| 5698 | static struct snd_pci_quirk beep_white_list[] = { |
| 5699 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5700 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5701 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5702 | {} |
| 5703 | }; |
| 5704 | |
| 5705 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5706 | { |
| 5707 | struct alc_spec *spec = codec->spec; |
| 5708 | const struct snd_pci_quirk *q; |
| 5709 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5710 | if (q) |
| 5711 | return q->value; |
| 5712 | return spec->cdefine.enable_pcbeep; |
| 5713 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5714 | #else |
| 5715 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5716 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5717 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5718 | |
| 5719 | /* |
| 5720 | * OK, here we have finally the patch for ALC880 |
| 5721 | */ |
| 5722 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5723 | static int patch_alc880(struct hda_codec *codec) |
| 5724 | { |
| 5725 | struct alc_spec *spec; |
| 5726 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5727 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5728 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5729 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5730 | if (spec == NULL) |
| 5731 | return -ENOMEM; |
| 5732 | |
| 5733 | codec->spec = spec; |
| 5734 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5735 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5736 | alc880_models, |
| 5737 | alc880_cfg_tbl); |
| 5738 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5739 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5740 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5741 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5742 | } |
| 5743 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5744 | if (board_config == ALC880_AUTO) { |
| 5745 | /* automatic parse from the BIOS config */ |
| 5746 | err = alc880_parse_auto_config(codec); |
| 5747 | if (err < 0) { |
| 5748 | alc_free(codec); |
| 5749 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5750 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5751 | printk(KERN_INFO |
| 5752 | "hda_codec: Cannot set up configuration " |
| 5753 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5754 | board_config = ALC880_3ST; |
| 5755 | } |
| 5756 | } |
| 5757 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5758 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5759 | if (err < 0) { |
| 5760 | alc_free(codec); |
| 5761 | return err; |
| 5762 | } |
| 5763 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5764 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5765 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5766 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5767 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5768 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5769 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5770 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5771 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5772 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5773 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5774 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5775 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5776 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5777 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5778 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5779 | if (wcap != AC_WID_AUD_IN) { |
| 5780 | spec->adc_nids = alc880_adc_nids_alt; |
| 5781 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5782 | } else { |
| 5783 | spec->adc_nids = alc880_adc_nids; |
| 5784 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5785 | } |
| 5786 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5787 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5788 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5789 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5790 | spec->vmaster_nid = 0x0c; |
| 5791 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5792 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5793 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5794 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5795 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5796 | if (!spec->loopback.amplist) |
| 5797 | spec->loopback.amplist = alc880_loopbacks; |
| 5798 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5799 | |
| 5800 | return 0; |
| 5801 | } |
| 5802 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5803 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5804 | /* |
| 5805 | * ALC260 support |
| 5806 | */ |
| 5807 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5808 | static hda_nid_t alc260_dac_nids[1] = { |
| 5809 | /* front */ |
| 5810 | 0x02, |
| 5811 | }; |
| 5812 | |
| 5813 | static hda_nid_t alc260_adc_nids[1] = { |
| 5814 | /* ADC0 */ |
| 5815 | 0x04, |
| 5816 | }; |
| 5817 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5818 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5819 | /* ADC1 */ |
| 5820 | 0x05, |
| 5821 | }; |
| 5822 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5823 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5824 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5825 | */ |
| 5826 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5827 | /* ADC0, ADC1 */ |
| 5828 | 0x04, 0x05 |
| 5829 | }; |
| 5830 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5831 | #define ALC260_DIGOUT_NID 0x03 |
| 5832 | #define ALC260_DIGIN_NID 0x06 |
| 5833 | |
| 5834 | static struct hda_input_mux alc260_capture_source = { |
| 5835 | .num_items = 4, |
| 5836 | .items = { |
| 5837 | { "Mic", 0x0 }, |
| 5838 | { "Front Mic", 0x1 }, |
| 5839 | { "Line", 0x2 }, |
| 5840 | { "CD", 0x4 }, |
| 5841 | }, |
| 5842 | }; |
| 5843 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5844 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5845 | * headphone jack and the internal CD lines since these are the only pins at |
| 5846 | * which audio can appear. For flexibility, also allow the option of |
| 5847 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5848 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5849 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5850 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5851 | { |
| 5852 | .num_items = 3, |
| 5853 | .items = { |
| 5854 | { "Mic/Line", 0x0 }, |
| 5855 | { "CD", 0x4 }, |
| 5856 | { "Headphone", 0x2 }, |
| 5857 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5858 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5859 | { |
| 5860 | .num_items = 4, |
| 5861 | .items = { |
| 5862 | { "Mic/Line", 0x0 }, |
| 5863 | { "CD", 0x4 }, |
| 5864 | { "Headphone", 0x2 }, |
| 5865 | { "Mixer", 0x5 }, |
| 5866 | }, |
| 5867 | }, |
| 5868 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5869 | }; |
| 5870 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5871 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5872 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5873 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5874 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5875 | { |
| 5876 | .num_items = 4, |
| 5877 | .items = { |
| 5878 | { "Mic", 0x0 }, |
| 5879 | { "Line", 0x2 }, |
| 5880 | { "CD", 0x4 }, |
| 5881 | { "Headphone", 0x5 }, |
| 5882 | }, |
| 5883 | }, |
| 5884 | { |
| 5885 | .num_items = 5, |
| 5886 | .items = { |
| 5887 | { "Mic", 0x0 }, |
| 5888 | { "Line", 0x2 }, |
| 5889 | { "CD", 0x4 }, |
| 5890 | { "Headphone", 0x6 }, |
| 5891 | { "Mixer", 0x5 }, |
| 5892 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5893 | }, |
| 5894 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5895 | |
| 5896 | /* Maxdata Favorit 100XS */ |
| 5897 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5898 | { |
| 5899 | .num_items = 2, |
| 5900 | .items = { |
| 5901 | { "Line/Mic", 0x0 }, |
| 5902 | { "CD", 0x4 }, |
| 5903 | }, |
| 5904 | }, |
| 5905 | { |
| 5906 | .num_items = 3, |
| 5907 | .items = { |
| 5908 | { "Line/Mic", 0x0 }, |
| 5909 | { "CD", 0x4 }, |
| 5910 | { "Mixer", 0x5 }, |
| 5911 | }, |
| 5912 | }, |
| 5913 | }; |
| 5914 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5915 | /* |
| 5916 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5917 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5918 | * element which allows changing the channel mode, so the verb list is |
| 5919 | * never used. |
| 5920 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5921 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5922 | { 2, NULL }, |
| 5923 | }; |
| 5924 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5925 | |
| 5926 | /* Mixer combinations |
| 5927 | * |
| 5928 | * basic: base_output + input + pc_beep + capture |
| 5929 | * HP: base_output + input + capture_alt |
| 5930 | * HP_3013: hp_3013 + input + capture |
| 5931 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5932 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5933 | */ |
| 5934 | |
| 5935 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5936 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5937 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5938 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5939 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5940 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5941 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5942 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5943 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5944 | |
| 5945 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5946 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5947 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5948 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5949 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5950 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5951 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5952 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5953 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5954 | { } /* end */ |
| 5955 | }; |
| 5956 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5957 | /* update HP, line and mono out pins according to the master switch */ |
| 5958 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5959 | hda_nid_t hp, hda_nid_t line, |
| 5960 | hda_nid_t mono) |
| 5961 | { |
| 5962 | struct alc_spec *spec = codec->spec; |
| 5963 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5964 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5965 | 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] | 5966 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5967 | 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] | 5968 | val); |
| 5969 | /* mono (speaker) depending on the HP jack sense */ |
| 5970 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5971 | 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] | 5972 | val); |
| 5973 | } |
| 5974 | |
| 5975 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5976 | struct snd_ctl_elem_value *ucontrol) |
| 5977 | { |
| 5978 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5979 | struct alc_spec *spec = codec->spec; |
| 5980 | *ucontrol->value.integer.value = spec->master_sw; |
| 5981 | return 0; |
| 5982 | } |
| 5983 | |
| 5984 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5985 | struct snd_ctl_elem_value *ucontrol) |
| 5986 | { |
| 5987 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5988 | struct alc_spec *spec = codec->spec; |
| 5989 | int val = !!*ucontrol->value.integer.value; |
| 5990 | hda_nid_t hp, line, mono; |
| 5991 | |
| 5992 | if (val == spec->master_sw) |
| 5993 | return 0; |
| 5994 | spec->master_sw = val; |
| 5995 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5996 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5997 | mono = kcontrol->private_value & 0xff; |
| 5998 | alc260_hp_master_update(codec, hp, line, mono); |
| 5999 | return 1; |
| 6000 | } |
| 6001 | |
| 6002 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 6003 | { |
| 6004 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6005 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6006 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6007 | .info = snd_ctl_boolean_mono_info, |
| 6008 | .get = alc260_hp_master_sw_get, |
| 6009 | .put = alc260_hp_master_sw_put, |
| 6010 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 6011 | }, |
| 6012 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6013 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 6014 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6015 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6016 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 6017 | HDA_OUTPUT), |
| 6018 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6019 | { } /* end */ |
| 6020 | }; |
| 6021 | |
| 6022 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 6023 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6024 | {}, |
| 6025 | }; |
| 6026 | |
| 6027 | static void alc260_hp_automute(struct hda_codec *codec) |
| 6028 | { |
| 6029 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6030 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6031 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6032 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 6033 | } |
| 6034 | |
| 6035 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6036 | { |
| 6037 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6038 | alc260_hp_automute(codec); |
| 6039 | } |
| 6040 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6041 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6042 | { |
| 6043 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6044 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6045 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6046 | .info = snd_ctl_boolean_mono_info, |
| 6047 | .get = alc260_hp_master_sw_get, |
| 6048 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6049 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6050 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6051 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6052 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6053 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6054 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6055 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6056 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6057 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6058 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6059 | { } /* end */ |
| 6060 | }; |
| 6061 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6062 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 6063 | .ops = &snd_hda_bind_vol, |
| 6064 | .values = { |
| 6065 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6066 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6067 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6068 | 0 |
| 6069 | }, |
| 6070 | }; |
| 6071 | |
| 6072 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 6073 | .ops = &snd_hda_bind_sw, |
| 6074 | .values = { |
| 6075 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6076 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6077 | 0 |
| 6078 | }, |
| 6079 | }; |
| 6080 | |
| 6081 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 6082 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6083 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6084 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6085 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6086 | { } /* end */ |
| 6087 | }; |
| 6088 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6089 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 6090 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6091 | {}, |
| 6092 | }; |
| 6093 | |
| 6094 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 6095 | { |
| 6096 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6097 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6098 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6099 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6100 | } |
| 6101 | |
| 6102 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 6103 | unsigned int res) |
| 6104 | { |
| 6105 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6106 | alc260_hp_3013_automute(codec); |
| 6107 | } |
| 6108 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6109 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 6110 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6111 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6112 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6113 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6114 | bits); |
| 6115 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6116 | bits); |
| 6117 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6118 | bits); |
| 6119 | } |
| 6120 | |
| 6121 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 6122 | unsigned int res) |
| 6123 | { |
| 6124 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6125 | alc260_hp_3012_automute(codec); |
| 6126 | } |
| 6127 | |
| 6128 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6129 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6130 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6131 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6132 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6133 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6134 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6135 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6136 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6137 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6138 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6139 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6140 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6141 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6142 | { } /* end */ |
| 6143 | }; |
| 6144 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6145 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6146 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6147 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6148 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6149 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6150 | * revisions available in early 2006. Therefore for now allow the |
| 6151 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6152 | * that the lack of mic bias for this NID is intentional we could change the |
| 6153 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6154 | * |
| 6155 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6156 | * don't appear to make the mic bias available from the "line" jack, even |
| 6157 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6158 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6159 | * and the output jack. If this turns out to be the case for all such |
| 6160 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6161 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6162 | * |
| 6163 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6164 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6165 | * controls for such models. On models without a "mono speaker" the control |
| 6166 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6167 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6168 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6169 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6170 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6171 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6172 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6173 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6174 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6175 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6176 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6177 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6178 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6179 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6180 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6181 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6182 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6183 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6184 | { } /* end */ |
| 6185 | }; |
| 6186 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6187 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6188 | */ |
| 6189 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6190 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6191 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6192 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6193 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6194 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6195 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6196 | { } /* end */ |
| 6197 | }; |
| 6198 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6199 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6200 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6201 | */ |
| 6202 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6203 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6204 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6205 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6206 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6207 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6208 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6209 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6210 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6211 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6212 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6213 | { } /* end */ |
| 6214 | }; |
| 6215 | |
| 6216 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6217 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6218 | */ |
| 6219 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6220 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6221 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6222 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6223 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6224 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6225 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6226 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6227 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6228 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6229 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6230 | { } /* end */ |
| 6231 | }; |
| 6232 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | /* |
| 6234 | * initialization verbs |
| 6235 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6236 | static struct hda_verb alc260_init_verbs[] = { |
| 6237 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6238 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6239 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6240 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6241 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6242 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6243 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6244 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6245 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6246 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6247 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6248 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6249 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6250 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6251 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6252 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6253 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6254 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6255 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6256 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6257 | /* set connection select to line in (default select for this ADC) */ |
| 6258 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6259 | /* mute capture amp left and right */ |
| 6260 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6261 | /* set connection select to line in (default select for this ADC) */ |
| 6262 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6263 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6264 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6265 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6266 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6267 | /* set vol=0 HP mixer amp left and right */ |
| 6268 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6269 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6270 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6271 | /* set vol=0 Mono mixer amp left and right */ |
| 6272 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6273 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6274 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6275 | /* unmute LINE-2 out pin */ |
| 6276 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6277 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6278 | * Line In 2 = 0x03 |
| 6279 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6280 | /* mute analog inputs */ |
| 6281 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6282 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6283 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6284 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6285 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6286 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6287 | /* mute Front out path */ |
| 6288 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6290 | /* mute Headphone out path */ |
| 6291 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6292 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6293 | /* mute Mono out path */ |
| 6294 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6295 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6296 | { } |
| 6297 | }; |
| 6298 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6299 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6300 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6301 | /* Headphone and output */ |
| 6302 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6303 | /* mono output */ |
| 6304 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6305 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6306 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6307 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6308 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6309 | /* Line In pin widget for input */ |
| 6310 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6311 | /* Line-2 pin widget for output */ |
| 6312 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6313 | /* CD pin widget for input */ |
| 6314 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6315 | /* unmute amp left and right */ |
| 6316 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6317 | /* set connection select to line in (default select for this ADC) */ |
| 6318 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6319 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6320 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6321 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6322 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6323 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6324 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6325 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6326 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6327 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6328 | * Line In 2 = 0x03 |
| 6329 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6330 | /* mute analog inputs */ |
| 6331 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6334 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6336 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6337 | /* Unmute Front out path */ |
| 6338 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6339 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6340 | /* Unmute Headphone out path */ |
| 6341 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6342 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6343 | /* Unmute Mono out path */ |
| 6344 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6345 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6346 | { } |
| 6347 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6348 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6349 | |
| 6350 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6351 | /* Line out and output */ |
| 6352 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6353 | /* mono output */ |
| 6354 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6355 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6356 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6357 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6358 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6359 | /* Line In pin widget for input */ |
| 6360 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6361 | /* Headphone pin widget for output */ |
| 6362 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6363 | /* CD pin widget for input */ |
| 6364 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6365 | /* unmute amp left and right */ |
| 6366 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6367 | /* set connection select to line in (default select for this ADC) */ |
| 6368 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6369 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6370 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6371 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6372 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6373 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6374 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6375 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6376 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6377 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6378 | * Line In 2 = 0x03 |
| 6379 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6380 | /* mute analog inputs */ |
| 6381 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6382 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6383 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6386 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6387 | /* Unmute Front out path */ |
| 6388 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6389 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6390 | /* Unmute Headphone out path */ |
| 6391 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6392 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6393 | /* Unmute Mono out path */ |
| 6394 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6395 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6396 | { } |
| 6397 | }; |
| 6398 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6399 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6400 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6401 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6402 | */ |
| 6403 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6404 | /* Disable all GPIOs */ |
| 6405 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6406 | /* Internal speaker is connected to headphone pin */ |
| 6407 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6408 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6409 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6410 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6411 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6412 | /* Ensure all other unused pins are disabled and muted. */ |
| 6413 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6414 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6415 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6416 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6417 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6418 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6419 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6420 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6421 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6422 | /* Disable digital (SPDIF) pins */ |
| 6423 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6424 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6425 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6426 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6427 | * when acting as an output. |
| 6428 | */ |
| 6429 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6430 | |
| 6431 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6432 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6433 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6434 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6435 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6436 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6437 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6438 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6439 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6440 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6441 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6442 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6443 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6444 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6445 | * If the pin mode is changed by the user the pin mode control will |
| 6446 | * take care of enabling the pin's input/output buffers as needed. |
| 6447 | * Therefore there's no need to enable the input buffer at this |
| 6448 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6449 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6450 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6451 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6452 | * mixer ctrl) |
| 6453 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6454 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6455 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6456 | /* Mute capture amp left and right */ |
| 6457 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6458 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6459 | * in (on mic1 pin) |
| 6460 | */ |
| 6461 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6462 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6463 | /* Do the same for the second ADC: mute capture input amp and |
| 6464 | * set ADC connection to line in (on mic1 pin) |
| 6465 | */ |
| 6466 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6467 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6468 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6469 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6470 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6471 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6472 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6473 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6474 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6475 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6476 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6477 | {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] | 6478 | |
| 6479 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6480 | }; |
| 6481 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6482 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6483 | * similar laptops (adapted from Fujitsu init verbs). |
| 6484 | */ |
| 6485 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6486 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6487 | * the headphone jack. Turn this on and rely on the standard mute |
| 6488 | * methods whenever the user wants to turn these outputs off. |
| 6489 | */ |
| 6490 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6491 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6492 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6493 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6494 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6495 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6496 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6497 | /* Line In jack is connected to Line1 pin */ |
| 6498 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6499 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6500 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6501 | /* Ensure all other unused pins are disabled and muted. */ |
| 6502 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6503 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6504 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6505 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6506 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6507 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6508 | /* Disable digital (SPDIF) pins */ |
| 6509 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6510 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6511 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6512 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6513 | * bus when acting as outputs. |
| 6514 | */ |
| 6515 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6516 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6517 | |
| 6518 | /* Start with output sum widgets muted and their output gains at min */ |
| 6519 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6520 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6521 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6522 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6523 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6524 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6525 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6526 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6527 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6528 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6529 | /* Unmute Line-out pin widget amp left and right |
| 6530 | * (no equiv mixer ctrl) |
| 6531 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6532 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6533 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6534 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6535 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6536 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6537 | * will take care of enabling the pin's input/output buffers as needed. |
| 6538 | * Therefore there's no need to enable the input buffer at this |
| 6539 | * stage. |
| 6540 | */ |
| 6541 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6542 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6543 | |
| 6544 | /* Mute capture amp left and right */ |
| 6545 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6546 | /* Set ADC connection select to match default mixer setting - mic |
| 6547 | * (on mic1 pin) |
| 6548 | */ |
| 6549 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6550 | |
| 6551 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6552 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6553 | */ |
| 6554 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6555 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6556 | |
| 6557 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6558 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6559 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6560 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6561 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6562 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6563 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6564 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6565 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6566 | |
| 6567 | { } |
| 6568 | }; |
| 6569 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6570 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6571 | * (adapted from Acer init verbs). |
| 6572 | */ |
| 6573 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6574 | /* GPIO 0 enables the output jack. |
| 6575 | * Turn this on and rely on the standard mute |
| 6576 | * methods whenever the user wants to turn these outputs off. |
| 6577 | */ |
| 6578 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6579 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6580 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6581 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6582 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6583 | /* Ensure all other unused pins are disabled and muted. */ |
| 6584 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6585 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6586 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6587 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6588 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6589 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6590 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6591 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6592 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6593 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6594 | /* Disable digital (SPDIF) pins */ |
| 6595 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6596 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6597 | |
| 6598 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6599 | * bus when acting as outputs. |
| 6600 | */ |
| 6601 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6602 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6603 | |
| 6604 | /* Start with output sum widgets muted and their output gains at min */ |
| 6605 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6606 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6607 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6608 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6609 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6610 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6611 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6612 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6613 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6614 | |
| 6615 | /* Unmute Line-out pin widget amp left and right |
| 6616 | * (no equiv mixer ctrl) |
| 6617 | */ |
| 6618 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6619 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6620 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6621 | * will take care of enabling the pin's input/output buffers as needed. |
| 6622 | * Therefore there's no need to enable the input buffer at this |
| 6623 | * stage. |
| 6624 | */ |
| 6625 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6626 | |
| 6627 | /* Mute capture amp left and right */ |
| 6628 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6629 | /* Set ADC connection select to match default mixer setting - mic |
| 6630 | * (on mic1 pin) |
| 6631 | */ |
| 6632 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6633 | |
| 6634 | /* Do similar with the second ADC: mute capture input amp and |
| 6635 | * set ADC connection to mic to match ALSA's default state. |
| 6636 | */ |
| 6637 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6638 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6639 | |
| 6640 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6641 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6643 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6644 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6646 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6648 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6649 | |
| 6650 | { } |
| 6651 | }; |
| 6652 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6653 | static struct hda_verb alc260_will_verbs[] = { |
| 6654 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6655 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6656 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6657 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6658 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6659 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6660 | {} |
| 6661 | }; |
| 6662 | |
| 6663 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6664 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6665 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6666 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6667 | |
| 6668 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6669 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6670 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6671 | |
| 6672 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6673 | {} |
| 6674 | }; |
| 6675 | |
| 6676 | /* toggle speaker-output according to the hp-jack state */ |
| 6677 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6678 | { |
| 6679 | unsigned int present; |
| 6680 | |
| 6681 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6682 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6683 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6684 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6685 | AC_VERB_SET_GPIO_DATA, 1); |
| 6686 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6687 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6688 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6689 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6690 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6691 | AC_VERB_SET_GPIO_DATA, 0); |
| 6692 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6693 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6694 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6695 | } |
| 6696 | } |
| 6697 | |
| 6698 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6699 | unsigned int res) |
| 6700 | { |
| 6701 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6702 | alc260_replacer_672v_automute(codec); |
| 6703 | } |
| 6704 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6705 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6706 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6707 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6708 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6709 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6710 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6711 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6712 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6713 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6714 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6715 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6716 | {} |
| 6717 | }; |
| 6718 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6719 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6720 | * configuration. |
| 6721 | */ |
| 6722 | #ifdef CONFIG_SND_DEBUG |
| 6723 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6724 | 0x02, |
| 6725 | }; |
| 6726 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6727 | 0x04, 0x05, |
| 6728 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6729 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6730 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6731 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6732 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6733 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6734 | { |
| 6735 | .num_items = 7, |
| 6736 | .items = { |
| 6737 | { "MIC1 pin", 0x0 }, |
| 6738 | { "MIC2 pin", 0x1 }, |
| 6739 | { "LINE1 pin", 0x2 }, |
| 6740 | { "LINE2 pin", 0x3 }, |
| 6741 | { "CD pin", 0x4 }, |
| 6742 | { "LINE-OUT pin", 0x5 }, |
| 6743 | { "HP-OUT pin", 0x6 }, |
| 6744 | }, |
| 6745 | }, |
| 6746 | { |
| 6747 | .num_items = 8, |
| 6748 | .items = { |
| 6749 | { "MIC1 pin", 0x0 }, |
| 6750 | { "MIC2 pin", 0x1 }, |
| 6751 | { "LINE1 pin", 0x2 }, |
| 6752 | { "LINE2 pin", 0x3 }, |
| 6753 | { "CD pin", 0x4 }, |
| 6754 | { "Mixer", 0x5 }, |
| 6755 | { "LINE-OUT pin", 0x6 }, |
| 6756 | { "HP-OUT pin", 0x7 }, |
| 6757 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6758 | }, |
| 6759 | }; |
| 6760 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6761 | /* Output driver widgets */ |
| 6762 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6763 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6764 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6765 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6766 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6767 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6768 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6769 | /* Modes for retasking pin widgets |
| 6770 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6771 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6772 | * mention this restriction. At this stage it's not clear whether |
| 6773 | * this behaviour is intentional or is a hardware bug in chip |
| 6774 | * revisions available at least up until early 2006. Therefore for |
| 6775 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6776 | * choices, but if it turns out that the lack of mic bias for these |
| 6777 | * NIDs is intentional we could change their modes from |
| 6778 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6779 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6780 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6781 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6782 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6783 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6784 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6785 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6786 | |
| 6787 | /* Loopback mixer controls */ |
| 6788 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6789 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6790 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6791 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6792 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6793 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6794 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6795 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6796 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6797 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6798 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6799 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6800 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6801 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6802 | |
| 6803 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6804 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6805 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6806 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6807 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6808 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6809 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6810 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6811 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6812 | */ |
| 6813 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6814 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6815 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6816 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6817 | * this output to turn on an external amplifier. |
| 6818 | */ |
| 6819 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6820 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6821 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6822 | { } /* end */ |
| 6823 | }; |
| 6824 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6825 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6826 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6827 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6828 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6829 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6830 | /* Enable retasking pins as output, initially without power amp */ |
| 6831 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6832 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6833 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6834 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6835 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6836 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6837 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6838 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6839 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6840 | * payload also sets the generation to 0, output to be in "consumer" |
| 6841 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6842 | * control. |
| 6843 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6844 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6845 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6846 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6847 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6848 | * OUT1 sum bus when acting as an output. |
| 6849 | */ |
| 6850 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6851 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6852 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6853 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6854 | |
| 6855 | /* Start with output sum widgets muted and their output gains at min */ |
| 6856 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6857 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6858 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6859 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6860 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6861 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6862 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6863 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6864 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6865 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6866 | /* Unmute retasking pin widget output buffers since the default |
| 6867 | * state appears to be output. As the pin mode is changed by the |
| 6868 | * user the pin mode control will take care of enabling the pin's |
| 6869 | * input/output buffers as needed. |
| 6870 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6871 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6872 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6873 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6874 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6875 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6876 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6877 | /* Also unmute the mono-out pin widget */ |
| 6878 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6879 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6880 | /* Mute capture amp left and right */ |
| 6881 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6882 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6883 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6884 | */ |
| 6885 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6886 | |
| 6887 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6888 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6889 | */ |
| 6890 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6891 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6892 | |
| 6893 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6894 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6895 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6896 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6897 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6898 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6900 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6902 | |
| 6903 | { } |
| 6904 | }; |
| 6905 | #endif |
| 6906 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6907 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6908 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6909 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6910 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6911 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6913 | /* |
| 6914 | * for BIOS auto-configuration |
| 6915 | */ |
| 6916 | |
| 6917 | 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] | 6918 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6919 | { |
| 6920 | hda_nid_t nid_vol; |
| 6921 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6922 | int err; |
| 6923 | |
| 6924 | if (nid >= 0x0f && nid < 0x11) { |
| 6925 | nid_vol = nid - 0x7; |
| 6926 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6927 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6928 | } else if (nid == 0x11) { |
| 6929 | nid_vol = nid - 0x7; |
| 6930 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6931 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6932 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6933 | nid_vol = 0x08; |
| 6934 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6935 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6936 | } else |
| 6937 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6938 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6939 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6940 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6941 | 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] | 6942 | if (err < 0) |
| 6943 | return err; |
| 6944 | *vol_bits |= (1 << nid_vol); |
| 6945 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6946 | 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] | 6947 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6948 | return err; |
| 6949 | return 1; |
| 6950 | } |
| 6951 | |
| 6952 | /* add playback controls from the parsed DAC table */ |
| 6953 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6954 | const struct auto_pin_cfg *cfg) |
| 6955 | { |
| 6956 | hda_nid_t nid; |
| 6957 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6958 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6959 | |
| 6960 | spec->multiout.num_dacs = 1; |
| 6961 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6962 | spec->multiout.dac_nids[0] = 0x02; |
| 6963 | |
| 6964 | nid = cfg->line_out_pins[0]; |
| 6965 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6966 | const char *pfx; |
| 6967 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6968 | pfx = "Master"; |
| 6969 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6970 | pfx = "Speaker"; |
| 6971 | else |
| 6972 | pfx = "Front"; |
| 6973 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6974 | if (err < 0) |
| 6975 | return err; |
| 6976 | } |
| 6977 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6978 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6979 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6980 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6981 | if (err < 0) |
| 6982 | return err; |
| 6983 | } |
| 6984 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6985 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6986 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6987 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6988 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6989 | if (err < 0) |
| 6990 | return err; |
| 6991 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6992 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6993 | } |
| 6994 | |
| 6995 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6996 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6997 | const struct auto_pin_cfg *cfg) |
| 6998 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6999 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7000 | } |
| 7001 | |
| 7002 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7003 | hda_nid_t nid, int pin_type, |
| 7004 | int sel_idx) |
| 7005 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7006 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7007 | /* need the manual connection? */ |
| 7008 | if (nid >= 0x12) { |
| 7009 | int idx = nid - 0x12; |
| 7010 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 7011 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7012 | } |
| 7013 | } |
| 7014 | |
| 7015 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 7016 | { |
| 7017 | struct alc_spec *spec = codec->spec; |
| 7018 | hda_nid_t nid; |
| 7019 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7020 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7021 | if (nid) { |
| 7022 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 7023 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 7024 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7025 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7026 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7027 | if (nid) |
| 7028 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 7029 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7030 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7031 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7032 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7033 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7034 | |
| 7035 | #define ALC260_PIN_CD_NID 0x16 |
| 7036 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 7037 | { |
| 7038 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7039 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7040 | int i; |
| 7041 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7042 | for (i = 0; i < cfg->num_inputs; i++) { |
| 7043 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7044 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 7045 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 7046 | if (nid != ALC260_PIN_CD_NID && |
| 7047 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7048 | snd_hda_codec_write(codec, nid, 0, |
| 7049 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7050 | AMP_OUT_MUTE); |
| 7051 | } |
| 7052 | } |
| 7053 | } |
| 7054 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7055 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7056 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7057 | /* |
| 7058 | * generic initialization of ADC, input mixers and output mixers |
| 7059 | */ |
| 7060 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 7061 | /* |
| 7062 | * Unmute ADC0-1 and set the default input to mic-in |
| 7063 | */ |
| 7064 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7065 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7066 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7067 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7068 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7069 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7070 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7071 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7072 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7073 | */ |
| 7074 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7075 | /* mute analog inputs */ |
| 7076 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7077 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7078 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7079 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7080 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7081 | |
| 7082 | /* |
| 7083 | * Set up output mixers (0x08 - 0x0a) |
| 7084 | */ |
| 7085 | /* set vol=0 to output mixers */ |
| 7086 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7087 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7088 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7089 | /* set up input amps for analog loopback */ |
| 7090 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7091 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7092 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7093 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7094 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7095 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7096 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7097 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7098 | { } |
| 7099 | }; |
| 7100 | |
| 7101 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7102 | { |
| 7103 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7104 | int err; |
| 7105 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7106 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7107 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7108 | alc260_ignore); |
| 7109 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7110 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7111 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7112 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7113 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7114 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7115 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7116 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7117 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7118 | return err; |
| 7119 | |
| 7120 | spec->multiout.max_channels = 2; |
| 7121 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7122 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7123 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7124 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7125 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7126 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7127 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7128 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7129 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7130 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7131 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7132 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7133 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7134 | return 1; |
| 7135 | } |
| 7136 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7137 | /* additional initialization for auto-configuration model */ |
| 7138 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7139 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7140 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7141 | alc260_auto_init_multi_out(codec); |
| 7142 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7143 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7144 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7145 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7146 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7147 | } |
| 7148 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7149 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7150 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7151 | { 0x07, HDA_INPUT, 0 }, |
| 7152 | { 0x07, HDA_INPUT, 1 }, |
| 7153 | { 0x07, HDA_INPUT, 2 }, |
| 7154 | { 0x07, HDA_INPUT, 3 }, |
| 7155 | { 0x07, HDA_INPUT, 4 }, |
| 7156 | { } /* end */ |
| 7157 | }; |
| 7158 | #endif |
| 7159 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7160 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7161 | * Pin config fixes |
| 7162 | */ |
| 7163 | enum { |
| 7164 | PINFIX_HP_DC5750, |
| 7165 | }; |
| 7166 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7167 | static const struct alc_fixup alc260_fixups[] = { |
| 7168 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7169 | .type = ALC_FIXUP_PINS, |
| 7170 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7171 | { 0x11, 0x90130110 }, /* speaker */ |
| 7172 | { } |
| 7173 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7174 | }, |
| 7175 | }; |
| 7176 | |
| 7177 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7178 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7179 | {} |
| 7180 | }; |
| 7181 | |
| 7182 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7183 | * ALC260 configurations |
| 7184 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7185 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7186 | [ALC260_BASIC] = "basic", |
| 7187 | [ALC260_HP] = "hp", |
| 7188 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7189 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7190 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7191 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7192 | [ALC260_WILL] = "will", |
| 7193 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7194 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7195 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7196 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7197 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7198 | [ALC260_AUTO] = "auto", |
| 7199 | }; |
| 7200 | |
| 7201 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7202 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7203 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7204 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7205 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7206 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7207 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7208 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7209 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7210 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7211 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7212 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7213 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7214 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7215 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7216 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7217 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7218 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7219 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7220 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7221 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7222 | {} |
| 7223 | }; |
| 7224 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7225 | static struct alc_config_preset alc260_presets[] = { |
| 7226 | [ALC260_BASIC] = { |
| 7227 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7228 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7229 | .init_verbs = { alc260_init_verbs }, |
| 7230 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7231 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7232 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7233 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7234 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7235 | .channel_mode = alc260_modes, |
| 7236 | .input_mux = &alc260_capture_source, |
| 7237 | }, |
| 7238 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7239 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7240 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7241 | .init_verbs = { alc260_init_verbs, |
| 7242 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7243 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7244 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7245 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7246 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7247 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7248 | .channel_mode = alc260_modes, |
| 7249 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7250 | .unsol_event = alc260_hp_unsol_event, |
| 7251 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7252 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7253 | [ALC260_HP_DC7600] = { |
| 7254 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7255 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7256 | .init_verbs = { alc260_init_verbs, |
| 7257 | alc260_hp_dc7600_verbs }, |
| 7258 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7259 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7260 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7261 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7262 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7263 | .channel_mode = alc260_modes, |
| 7264 | .input_mux = &alc260_capture_source, |
| 7265 | .unsol_event = alc260_hp_3012_unsol_event, |
| 7266 | .init_hook = alc260_hp_3012_automute, |
| 7267 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7268 | [ALC260_HP_3013] = { |
| 7269 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7270 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7271 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7272 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7273 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7274 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7275 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7276 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7277 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7278 | .channel_mode = alc260_modes, |
| 7279 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7280 | .unsol_event = alc260_hp_3013_unsol_event, |
| 7281 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7282 | }, |
| 7283 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7284 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7285 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7286 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7287 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7288 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7289 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7290 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7291 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7292 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7293 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7294 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7295 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7296 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7297 | .init_verbs = { alc260_acer_init_verbs }, |
| 7298 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7299 | .dac_nids = alc260_dac_nids, |
| 7300 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7301 | .adc_nids = alc260_dual_adc_nids, |
| 7302 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7303 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7304 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7305 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7306 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7307 | [ALC260_FAVORIT100] = { |
| 7308 | .mixers = { alc260_favorit100_mixer }, |
| 7309 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7310 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7311 | .dac_nids = alc260_dac_nids, |
| 7312 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7313 | .adc_nids = alc260_dual_adc_nids, |
| 7314 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7315 | .channel_mode = alc260_modes, |
| 7316 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7317 | .input_mux = alc260_favorit100_capture_sources, |
| 7318 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7319 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7320 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7321 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7322 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7323 | .dac_nids = alc260_dac_nids, |
| 7324 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7325 | .adc_nids = alc260_adc_nids, |
| 7326 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7327 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7328 | .channel_mode = alc260_modes, |
| 7329 | .input_mux = &alc260_capture_source, |
| 7330 | }, |
| 7331 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7332 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7333 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7334 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7335 | .dac_nids = alc260_dac_nids, |
| 7336 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7337 | .adc_nids = alc260_adc_nids, |
| 7338 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7339 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7340 | .channel_mode = alc260_modes, |
| 7341 | .input_mux = &alc260_capture_source, |
| 7342 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7343 | .init_hook = alc260_replacer_672v_automute, |
| 7344 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7345 | #ifdef CONFIG_SND_DEBUG |
| 7346 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7347 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7348 | .init_verbs = { alc260_test_init_verbs }, |
| 7349 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7350 | .dac_nids = alc260_test_dac_nids, |
| 7351 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7352 | .adc_nids = alc260_test_adc_nids, |
| 7353 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7354 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7355 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7356 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7357 | }, |
| 7358 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7359 | }; |
| 7360 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7361 | static int patch_alc260(struct hda_codec *codec) |
| 7362 | { |
| 7363 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7364 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7365 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7366 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7367 | if (spec == NULL) |
| 7368 | return -ENOMEM; |
| 7369 | |
| 7370 | codec->spec = spec; |
| 7371 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7372 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7373 | alc260_models, |
| 7374 | alc260_cfg_tbl); |
| 7375 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7376 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7377 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7378 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7379 | } |
| 7380 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7381 | if (board_config == ALC260_AUTO) { |
| 7382 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7383 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7384 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7385 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7386 | if (board_config == ALC260_AUTO) { |
| 7387 | /* automatic parse from the BIOS config */ |
| 7388 | err = alc260_parse_auto_config(codec); |
| 7389 | if (err < 0) { |
| 7390 | alc_free(codec); |
| 7391 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7392 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7393 | printk(KERN_INFO |
| 7394 | "hda_codec: Cannot set up configuration " |
| 7395 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7396 | board_config = ALC260_BASIC; |
| 7397 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7398 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7399 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7400 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7401 | if (err < 0) { |
| 7402 | alc_free(codec); |
| 7403 | return err; |
| 7404 | } |
| 7405 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7406 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7407 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7408 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7409 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7410 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7411 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7412 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7413 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7414 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7415 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7416 | if (!spec->adc_nids && spec->input_mux) { |
| 7417 | /* check whether NID 0x04 is valid */ |
| 7418 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7419 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7420 | /* get type */ |
| 7421 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7422 | spec->adc_nids = alc260_adc_nids_alt; |
| 7423 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7424 | } else { |
| 7425 | spec->adc_nids = alc260_adc_nids; |
| 7426 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7427 | } |
| 7428 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7429 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7430 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7431 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7432 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7433 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7434 | spec->vmaster_nid = 0x08; |
| 7435 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7436 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7437 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7438 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7439 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7440 | if (!spec->loopback.amplist) |
| 7441 | spec->loopback.amplist = alc260_loopbacks; |
| 7442 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7443 | |
| 7444 | return 0; |
| 7445 | } |
| 7446 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7447 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7448 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7449 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7450 | * |
| 7451 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7452 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7453 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7454 | * 6-channel independent captures. |
| 7455 | * |
| 7456 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7457 | * driver yet). |
| 7458 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7459 | #define ALC882_DIGOUT_NID 0x06 |
| 7460 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7461 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7462 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7463 | #define ALC1200_DIGOUT_NID 0x10 |
| 7464 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7465 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7466 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7467 | { 8, NULL } |
| 7468 | }; |
| 7469 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7470 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7471 | static hda_nid_t alc882_dac_nids[4] = { |
| 7472 | /* front, rear, clfe, rear_surr */ |
| 7473 | 0x02, 0x03, 0x04, 0x05 |
| 7474 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7475 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7476 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7477 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7478 | #define alc882_adc_nids alc880_adc_nids |
| 7479 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7480 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7481 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7482 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7483 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7484 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7485 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7486 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7487 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7488 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7489 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7490 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7491 | /* input MUX */ |
| 7492 | /* FIXME: should be a matrix-type input source selection */ |
| 7493 | |
| 7494 | static struct hda_input_mux alc882_capture_source = { |
| 7495 | .num_items = 4, |
| 7496 | .items = { |
| 7497 | { "Mic", 0x0 }, |
| 7498 | { "Front Mic", 0x1 }, |
| 7499 | { "Line", 0x2 }, |
| 7500 | { "CD", 0x4 }, |
| 7501 | }, |
| 7502 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7503 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7504 | #define alc883_capture_source alc882_capture_source |
| 7505 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7506 | static struct hda_input_mux alc889_capture_source = { |
| 7507 | .num_items = 3, |
| 7508 | .items = { |
| 7509 | { "Front Mic", 0x0 }, |
| 7510 | { "Mic", 0x3 }, |
| 7511 | { "Line", 0x2 }, |
| 7512 | }, |
| 7513 | }; |
| 7514 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7515 | static struct hda_input_mux mb5_capture_source = { |
| 7516 | .num_items = 3, |
| 7517 | .items = { |
| 7518 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7519 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7520 | { "CD", 0x4 }, |
| 7521 | }, |
| 7522 | }; |
| 7523 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7524 | static struct hda_input_mux macmini3_capture_source = { |
| 7525 | .num_items = 2, |
| 7526 | .items = { |
| 7527 | { "Line", 0x2 }, |
| 7528 | { "CD", 0x4 }, |
| 7529 | }, |
| 7530 | }; |
| 7531 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7532 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7533 | .num_items = 4, |
| 7534 | .items = { |
| 7535 | { "Mic", 0x1 }, |
| 7536 | { "Front Mic", 0x0 }, |
| 7537 | { "Line", 0x2 }, |
| 7538 | { "CD", 0x4 }, |
| 7539 | }, |
| 7540 | }; |
| 7541 | |
| 7542 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7543 | .num_items = 2, |
| 7544 | .items = { |
| 7545 | { "Mic", 0x1 }, |
| 7546 | { "Line", 0x2 }, |
| 7547 | }, |
| 7548 | }; |
| 7549 | |
| 7550 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7551 | .num_items = 4, |
| 7552 | .items = { |
| 7553 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7554 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7555 | { "Line", 0x2 }, |
| 7556 | { "CD", 0x4 }, |
| 7557 | }, |
| 7558 | }; |
| 7559 | |
| 7560 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7561 | .num_items = 2, |
| 7562 | .items = { |
| 7563 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7564 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7565 | }, |
| 7566 | }; |
| 7567 | |
| 7568 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7569 | .num_items = 3, |
| 7570 | .items = { |
| 7571 | { "Mic", 0x0 }, |
| 7572 | { "Front Mic", 0x1 }, |
| 7573 | { "Line", 0x4 }, |
| 7574 | }, |
| 7575 | }; |
| 7576 | |
| 7577 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7578 | .num_items = 2, |
| 7579 | .items = { |
| 7580 | { "Mic", 0x0 }, |
| 7581 | { "Line", 0x2 }, |
| 7582 | }, |
| 7583 | }; |
| 7584 | |
| 7585 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7586 | .num_items = 2, |
| 7587 | .items = { |
| 7588 | { "Mic", 0x0 }, |
| 7589 | /* Front Mic (0x01) unused */ |
| 7590 | { "Line", 0x2 }, |
| 7591 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7592 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7593 | }, |
| 7594 | }; |
| 7595 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7596 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7597 | .num_items = 2, |
| 7598 | .items = { |
| 7599 | { "Mic", 0x01 }, |
| 7600 | { "Line", 0x2 }, /* Not sure! */ |
| 7601 | }, |
| 7602 | }; |
| 7603 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7604 | /* |
| 7605 | * 2ch mode |
| 7606 | */ |
| 7607 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7608 | { 2, NULL } |
| 7609 | }; |
| 7610 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7611 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7612 | * 2ch mode |
| 7613 | */ |
| 7614 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7615 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7616 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7617 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7618 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7619 | { } /* end */ |
| 7620 | }; |
| 7621 | |
| 7622 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7623 | * 4ch mode |
| 7624 | */ |
| 7625 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7626 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7627 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7628 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7629 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7630 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7631 | { } /* end */ |
| 7632 | }; |
| 7633 | |
| 7634 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7635 | * 6ch mode |
| 7636 | */ |
| 7637 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7638 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7639 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7640 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7641 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7642 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7643 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7644 | { } /* end */ |
| 7645 | }; |
| 7646 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7647 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7648 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7649 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7650 | { 6, alc882_3ST_ch6_init }, |
| 7651 | }; |
| 7652 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7653 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7654 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7655 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7656 | * 2ch mode |
| 7657 | */ |
| 7658 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7659 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7660 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7661 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7662 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7663 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7664 | { } /* end */ |
| 7665 | }; |
| 7666 | |
| 7667 | /* |
| 7668 | * 4ch mode |
| 7669 | */ |
| 7670 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7671 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7672 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7673 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7674 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7675 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7676 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7677 | { } /* end */ |
| 7678 | }; |
| 7679 | |
| 7680 | /* |
| 7681 | * 6ch mode |
| 7682 | */ |
| 7683 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7684 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7685 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7686 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7687 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7688 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7689 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7690 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7691 | { } /* end */ |
| 7692 | }; |
| 7693 | |
| 7694 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7695 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7696 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7697 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7698 | }; |
| 7699 | |
| 7700 | |
| 7701 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7702 | * 6ch mode |
| 7703 | */ |
| 7704 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7705 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7706 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7707 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7708 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7709 | { } /* end */ |
| 7710 | }; |
| 7711 | |
| 7712 | /* |
| 7713 | * 8ch mode |
| 7714 | */ |
| 7715 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7716 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7717 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7718 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7719 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7720 | { } /* end */ |
| 7721 | }; |
| 7722 | |
| 7723 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7724 | { 6, alc882_sixstack_ch6_init }, |
| 7725 | { 8, alc882_sixstack_ch8_init }, |
| 7726 | }; |
| 7727 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7728 | |
| 7729 | /* Macbook Air 2,1 */ |
| 7730 | |
| 7731 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7732 | { 2, NULL }, |
| 7733 | }; |
| 7734 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7735 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7736 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7737 | */ |
| 7738 | |
| 7739 | /* |
| 7740 | * 2ch mode |
| 7741 | */ |
| 7742 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7743 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7744 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7745 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7746 | { } /* end */ |
| 7747 | }; |
| 7748 | |
| 7749 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7750 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7751 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7752 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7753 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7754 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7755 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7756 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7757 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7758 | { } /* end */ |
| 7759 | }; |
| 7760 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7761 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7762 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7763 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7764 | }; |
| 7765 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7766 | /* |
| 7767 | * 2ch |
| 7768 | * Speakers/Woofer/HP = Front |
| 7769 | * LineIn = Input |
| 7770 | */ |
| 7771 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7772 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7774 | { } /* end */ |
| 7775 | }; |
| 7776 | |
| 7777 | /* |
| 7778 | * 6ch mode |
| 7779 | * Speakers/HP = Front |
| 7780 | * Woofer = LFE |
| 7781 | * LineIn = Surround |
| 7782 | */ |
| 7783 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7784 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7785 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7786 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7787 | { } /* end */ |
| 7788 | }; |
| 7789 | |
| 7790 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7791 | { 2, alc885_mb5_ch2_init }, |
| 7792 | { 6, alc885_mb5_ch6_init }, |
| 7793 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7794 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7795 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7796 | |
| 7797 | /* |
| 7798 | * 2ch mode |
| 7799 | */ |
| 7800 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7801 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7802 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7803 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7804 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7805 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7806 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7807 | { } /* end */ |
| 7808 | }; |
| 7809 | |
| 7810 | /* |
| 7811 | * 4ch mode |
| 7812 | */ |
| 7813 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7814 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7815 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7816 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7817 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7818 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7819 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7820 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7821 | { } /* end */ |
| 7822 | }; |
| 7823 | |
| 7824 | /* |
| 7825 | * 6ch mode |
| 7826 | */ |
| 7827 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7828 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7829 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7830 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7831 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7832 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7833 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7834 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7835 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7836 | { } /* end */ |
| 7837 | }; |
| 7838 | |
| 7839 | /* |
| 7840 | * 8ch mode |
| 7841 | */ |
| 7842 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7843 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7844 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7845 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7846 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7847 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7848 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7849 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7850 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7851 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7852 | { } /* end */ |
| 7853 | }; |
| 7854 | |
| 7855 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7856 | { 2, alc883_4ST_ch2_init }, |
| 7857 | { 4, alc883_4ST_ch4_init }, |
| 7858 | { 6, alc883_4ST_ch6_init }, |
| 7859 | { 8, alc883_4ST_ch8_init }, |
| 7860 | }; |
| 7861 | |
| 7862 | |
| 7863 | /* |
| 7864 | * 2ch mode |
| 7865 | */ |
| 7866 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7867 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7868 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7869 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7870 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7871 | { } /* end */ |
| 7872 | }; |
| 7873 | |
| 7874 | /* |
| 7875 | * 4ch mode |
| 7876 | */ |
| 7877 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7878 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7879 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7880 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7881 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7882 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7883 | { } /* end */ |
| 7884 | }; |
| 7885 | |
| 7886 | /* |
| 7887 | * 6ch mode |
| 7888 | */ |
| 7889 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7890 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7891 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7892 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7893 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7894 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7895 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7896 | { } /* end */ |
| 7897 | }; |
| 7898 | |
| 7899 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7900 | { 2, alc883_3ST_ch2_intel_init }, |
| 7901 | { 4, alc883_3ST_ch4_intel_init }, |
| 7902 | { 6, alc883_3ST_ch6_intel_init }, |
| 7903 | }; |
| 7904 | |
| 7905 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7906 | * 2ch mode |
| 7907 | */ |
| 7908 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7909 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7910 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7911 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7912 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7913 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7914 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7915 | { } /* end */ |
| 7916 | }; |
| 7917 | |
| 7918 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7919 | * 6ch mode |
| 7920 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7921 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7922 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7923 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7924 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7925 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7926 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7927 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7928 | { } /* end */ |
| 7929 | }; |
| 7930 | |
| 7931 | /* |
| 7932 | * 8ch mode |
| 7933 | */ |
| 7934 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7935 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7936 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7937 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7938 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7939 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7940 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7941 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7942 | { } /* end */ |
| 7943 | }; |
| 7944 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7945 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7946 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7947 | { 6, alc889_ch6_intel_init }, |
| 7948 | { 8, alc889_ch8_intel_init }, |
| 7949 | }; |
| 7950 | |
| 7951 | /* |
| 7952 | * 6ch mode |
| 7953 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7954 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7955 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7956 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7957 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7958 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7959 | { } /* end */ |
| 7960 | }; |
| 7961 | |
| 7962 | /* |
| 7963 | * 8ch mode |
| 7964 | */ |
| 7965 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7966 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7967 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7968 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7969 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7970 | { } /* end */ |
| 7971 | }; |
| 7972 | |
| 7973 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7974 | { 6, alc883_sixstack_ch6_init }, |
| 7975 | { 8, alc883_sixstack_ch8_init }, |
| 7976 | }; |
| 7977 | |
| 7978 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7979 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7980 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7981 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7982 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7985 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7986 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7987 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7988 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7989 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7990 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7991 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7992 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7993 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7994 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7995 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7996 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7997 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7998 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7999 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8000 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8001 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8002 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8003 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8004 | { } /* end */ |
| 8005 | }; |
| 8006 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8007 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 8008 | |
| 8009 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 8010 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8011 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 8012 | { } |
| 8013 | }; |
| 8014 | |
| 8015 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8016 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8017 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8018 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8019 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8020 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8021 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8022 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8023 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8024 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8025 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8026 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 8027 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8028 | { } /* end */ |
| 8029 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8030 | |
| 8031 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8032 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8033 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8034 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8035 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8036 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8037 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8038 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8039 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8040 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8041 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8042 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8043 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8044 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 8045 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8046 | { } /* end */ |
| 8047 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8048 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8049 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 8050 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8051 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8052 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8053 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8054 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8055 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8056 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8057 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8058 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8059 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8060 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8061 | { } /* end */ |
| 8062 | }; |
| 8063 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8064 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8065 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8066 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8067 | { } /* end */ |
| 8068 | }; |
| 8069 | |
| 8070 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8071 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 8072 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8073 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8074 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8075 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8076 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8077 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8078 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8079 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8081 | { } /* end */ |
| 8082 | }; |
| 8083 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8084 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 8085 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8086 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8087 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8088 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8089 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8090 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8091 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8092 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8093 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8094 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8095 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8096 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8097 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8098 | { } /* end */ |
| 8099 | }; |
| 8100 | |
| 8101 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8102 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8103 | */ |
| 8104 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8105 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8106 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8107 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8108 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8109 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8110 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8111 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8112 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8113 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8114 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8115 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8116 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8117 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8118 | { } /* end */ |
| 8119 | }; |
| 8120 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8121 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8122 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8123 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8124 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8125 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8126 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8130 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8131 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8132 | { } /* end */ |
| 8133 | }; |
| 8134 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8135 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8136 | { |
| 8137 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8138 | .name = "Channel Mode", |
| 8139 | .info = alc_ch_mode_info, |
| 8140 | .get = alc_ch_mode_get, |
| 8141 | .put = alc_ch_mode_put, |
| 8142 | }, |
| 8143 | { } /* end */ |
| 8144 | }; |
| 8145 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8146 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8147 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8148 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8150 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8151 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8152 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8153 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8154 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8155 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8156 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8157 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8158 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8159 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8160 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8161 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8162 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8163 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8164 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8165 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8166 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8167 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8168 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8169 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8170 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8171 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8172 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8173 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8174 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8175 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8176 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8177 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8178 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8179 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8180 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8181 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8182 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8183 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8184 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8185 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8186 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8187 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8188 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8189 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8190 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8191 | |
| 8192 | /* FIXME: use matrix-type input source selection */ |
| 8193 | /* 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] | 8194 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8195 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8196 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8197 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8198 | /* ADC2: mute amp left and right */ |
| 8199 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8200 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8201 | /* ADC3: mute amp left and right */ |
| 8202 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8203 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8204 | |
| 8205 | { } |
| 8206 | }; |
| 8207 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8208 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8209 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8210 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8211 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8212 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8213 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8214 | /* ADC1: mute amp left and right */ |
| 8215 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8216 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8217 | { } |
| 8218 | }; |
| 8219 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8220 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8221 | /* change to EAPD mode */ |
| 8222 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8223 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8224 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8225 | }; |
| 8226 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8227 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8228 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8229 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8230 | { } |
| 8231 | }; |
| 8232 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8233 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8234 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8236 | {} |
| 8237 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8238 | |
| 8239 | static struct hda_verb alc885_init_verbs[] = { |
| 8240 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8241 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8242 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8243 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8244 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8245 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8246 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8247 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8248 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8249 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8250 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8251 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8252 | |
| 8253 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8254 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8255 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8256 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8257 | /* Front Pin: output 0 (0x0c) */ |
| 8258 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8259 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8260 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8261 | /* Rear Pin: output 1 (0x0d) */ |
| 8262 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8263 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8264 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8265 | /* CLFE Pin: output 2 (0x0e) */ |
| 8266 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8267 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8268 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8269 | /* Side Pin: output 3 (0x0f) */ |
| 8270 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8271 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8272 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8273 | /* Mic (rear) pin: input vref at 80% */ |
| 8274 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8275 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8276 | /* Front Mic pin: input vref at 80% */ |
| 8277 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8278 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8279 | /* Line In pin: input */ |
| 8280 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8281 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8282 | |
| 8283 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8284 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8285 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8286 | /* Input mixer2 */ |
| 8287 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8288 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8289 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8290 | /* ADC2: mute amp left and right */ |
| 8291 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8292 | /* ADC3: mute amp left and right */ |
| 8293 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8294 | |
| 8295 | { } |
| 8296 | }; |
| 8297 | |
| 8298 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8299 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8300 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8301 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8302 | { } |
| 8303 | }; |
| 8304 | |
| 8305 | |
| 8306 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8307 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8308 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8309 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8310 | { } |
| 8311 | }; |
| 8312 | |
| 8313 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8314 | #define alc883_init_verbs alc882_base_init_verbs |
| 8315 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8316 | /* Mac Pro test */ |
| 8317 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8318 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8319 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8320 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8321 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8322 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8323 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8324 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8325 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8326 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8327 | { } /* end */ |
| 8328 | }; |
| 8329 | |
| 8330 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8331 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8332 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8333 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8335 | /* Front Pin: output 0 (0x0c) */ |
| 8336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8337 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8338 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8339 | /* Front Mic pin: input vref at 80% */ |
| 8340 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8341 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8342 | /* Speaker: output */ |
| 8343 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8344 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8345 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8346 | /* Headphone output (output 0 - 0x0c) */ |
| 8347 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8348 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8349 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8350 | |
| 8351 | /* FIXME: use matrix-type input source selection */ |
| 8352 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8353 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8354 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8355 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8356 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8357 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8358 | /* Input mixer2 */ |
| 8359 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8360 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8361 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8362 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8363 | /* Input mixer3 */ |
| 8364 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8365 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8366 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8367 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8368 | /* ADC1: mute amp left and right */ |
| 8369 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8370 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8371 | /* ADC2: mute amp left and right */ |
| 8372 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8373 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8374 | /* ADC3: mute amp left and right */ |
| 8375 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8376 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8377 | |
| 8378 | { } |
| 8379 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8380 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8381 | /* Macbook 5,1 */ |
| 8382 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8383 | /* DACs */ |
| 8384 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8385 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8386 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8387 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8388 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8389 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8390 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8391 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8392 | /* Surround mixer */ |
| 8393 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8394 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8395 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8396 | /* LFE mixer */ |
| 8397 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8399 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8400 | /* HP mixer */ |
| 8401 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8402 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8403 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8404 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8405 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8406 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8407 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8408 | /* LFE Pin (0x0e) */ |
| 8409 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8410 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8411 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8412 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8413 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8414 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8415 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8416 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8417 | /* Front Mic pin: input vref at 80% */ |
| 8418 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8419 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8420 | /* Line In pin */ |
| 8421 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8422 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8423 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8424 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8425 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8426 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8427 | { } |
| 8428 | }; |
| 8429 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8430 | /* Macmini 3,1 */ |
| 8431 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8432 | /* DACs */ |
| 8433 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8434 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8435 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8436 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8437 | /* Front mixer */ |
| 8438 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8439 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8440 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8441 | /* Surround mixer */ |
| 8442 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8443 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8444 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8445 | /* LFE mixer */ |
| 8446 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8447 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8448 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8449 | /* HP mixer */ |
| 8450 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8451 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8452 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8453 | /* Front Pin (0x0c) */ |
| 8454 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8455 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8456 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8457 | /* LFE Pin (0x0e) */ |
| 8458 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8459 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8460 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8461 | /* HP Pin (0x0f) */ |
| 8462 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8463 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8464 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8465 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8466 | /* Line In pin */ |
| 8467 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8468 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8469 | |
| 8470 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8471 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8472 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8473 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8474 | { } |
| 8475 | }; |
| 8476 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8477 | |
| 8478 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8479 | /*Internal and HP Speaker Mixer*/ |
| 8480 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8481 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8482 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8483 | /*Internal Speaker Pin (0x0c)*/ |
| 8484 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8485 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8486 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8487 | /* HP Pin: output 0 (0x0e) */ |
| 8488 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8489 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8490 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8491 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8492 | /* Line in (is hp when jack connected)*/ |
| 8493 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8494 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8495 | |
| 8496 | { } |
| 8497 | }; |
| 8498 | |
| 8499 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8500 | /* Macbook Pro rev3 */ |
| 8501 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8502 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8505 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8506 | /* Rear mixer */ |
| 8507 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8508 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8509 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8510 | /* HP mixer */ |
| 8511 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8512 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8513 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8514 | /* Front Pin: output 0 (0x0c) */ |
| 8515 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8516 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8517 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8518 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8519 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8521 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8522 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8523 | /* Mic (rear) pin: input vref at 80% */ |
| 8524 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8525 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8526 | /* Front Mic pin: input vref at 80% */ |
| 8527 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8528 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8529 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8530 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8531 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8532 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8533 | |
| 8534 | /* FIXME: use matrix-type input source selection */ |
| 8535 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8536 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8537 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8538 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8539 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8540 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8541 | /* Input mixer2 */ |
| 8542 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8543 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8544 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8545 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8546 | /* Input mixer3 */ |
| 8547 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8548 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8549 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8550 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8551 | /* ADC1: mute amp left and right */ |
| 8552 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8553 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8554 | /* ADC2: mute amp left and right */ |
| 8555 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8556 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8557 | /* ADC3: mute amp left and right */ |
| 8558 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8559 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8560 | |
| 8561 | { } |
| 8562 | }; |
| 8563 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8564 | /* iMac 9,1 */ |
| 8565 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8566 | /* Internal Speaker Pin (0x0c) */ |
| 8567 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8568 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8569 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8570 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8571 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8572 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8573 | /* HP Pin: Rear */ |
| 8574 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8575 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8576 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8577 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8578 | /* Line in Rear */ |
| 8579 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8580 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8581 | /* Front Mic pin: input vref at 80% */ |
| 8582 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8583 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8584 | /* Rear mixer */ |
| 8585 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8588 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8589 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8592 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8593 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8594 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8595 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8596 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8597 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8598 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8599 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8600 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8601 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8602 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8603 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8604 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8605 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8606 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8607 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8608 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8609 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8610 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8611 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8612 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8613 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8614 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8615 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8616 | { } |
| 8617 | }; |
| 8618 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8619 | /* iMac 24 mixer. */ |
| 8620 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8621 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8622 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8623 | { } /* end */ |
| 8624 | }; |
| 8625 | |
| 8626 | /* iMac 24 init verbs. */ |
| 8627 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8628 | /* Internal speakers: output 0 (0x0c) */ |
| 8629 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8630 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8631 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8632 | /* Internal speakers: output 0 (0x0c) */ |
| 8633 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8634 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8635 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8636 | /* Headphone: output 0 (0x0c) */ |
| 8637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8638 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8639 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8640 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8641 | /* Front Mic: input vref at 80% */ |
| 8642 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8643 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8644 | { } |
| 8645 | }; |
| 8646 | |
| 8647 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8648 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8649 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8650 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8651 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8652 | spec->autocfg.hp_pins[0] = 0x14; |
| 8653 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8654 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8655 | } |
| 8656 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8657 | #define alc885_mb5_setup alc885_imac24_setup |
| 8658 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8659 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8660 | /* Macbook Air 2,1 */ |
| 8661 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8662 | { |
| 8663 | struct alc_spec *spec = codec->spec; |
| 8664 | |
| 8665 | spec->autocfg.hp_pins[0] = 0x14; |
| 8666 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8667 | } |
| 8668 | |
| 8669 | |
| 8670 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8671 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8672 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8673 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8674 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8675 | spec->autocfg.hp_pins[0] = 0x15; |
| 8676 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8677 | } |
| 8678 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8679 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8680 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8681 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8682 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8683 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8684 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8685 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8686 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8687 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8688 | static struct hda_verb alc882_targa_verbs[] = { |
| 8689 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8690 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8691 | |
| 8692 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8693 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8694 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8695 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8696 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8697 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8698 | |
| 8699 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8700 | { } /* end */ |
| 8701 | }; |
| 8702 | |
| 8703 | /* toggle speaker-output according to the hp-jack state */ |
| 8704 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8705 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8706 | struct alc_spec *spec = codec->spec; |
| 8707 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8708 | 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] | 8709 | spec->jack_present ? 1 : 3); |
| 8710 | } |
| 8711 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8712 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8713 | { |
| 8714 | struct alc_spec *spec = codec->spec; |
| 8715 | |
| 8716 | spec->autocfg.hp_pins[0] = 0x14; |
| 8717 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8718 | } |
| 8719 | |
| 8720 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8721 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8722 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8723 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8724 | } |
| 8725 | |
| 8726 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8727 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8728 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8729 | |
| 8730 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8731 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8732 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8733 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8734 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8735 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8736 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8737 | |
| 8738 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8739 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8740 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8741 | { } /* end */ |
| 8742 | }; |
| 8743 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8744 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8745 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8747 | |
| 8748 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8749 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8750 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8751 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8752 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8753 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8754 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8755 | |
| 8756 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8757 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8758 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8759 | { } /* end */ |
| 8760 | }; |
| 8761 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8762 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8763 | { |
| 8764 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8765 | |
| 8766 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8767 | AC_VERB_GET_GPIO_DATA, 0); |
| 8768 | |
| 8769 | if (!muted) |
| 8770 | gpiostate |= (1 << pin); |
| 8771 | else |
| 8772 | gpiostate &= ~(1 << pin); |
| 8773 | |
| 8774 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8775 | AC_VERB_GET_GPIO_MASK, 0); |
| 8776 | gpiomask |= (1 << pin); |
| 8777 | |
| 8778 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8779 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8780 | gpiodir |= (1 << pin); |
| 8781 | |
| 8782 | |
| 8783 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8784 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8785 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8786 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8787 | |
| 8788 | msleep(1); |
| 8789 | |
| 8790 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8791 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8792 | } |
| 8793 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8794 | /* set up GPIO at initialization */ |
| 8795 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8796 | { |
| 8797 | alc882_gpio_mute(codec, 0, 0); |
| 8798 | alc882_gpio_mute(codec, 1, 0); |
| 8799 | } |
| 8800 | |
| 8801 | /* set up GPIO and update auto-muting at initialization */ |
| 8802 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8803 | { |
| 8804 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8805 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8806 | } |
| 8807 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8808 | /* |
| 8809 | * generic initialization of ADC, input mixers and output mixers |
| 8810 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8811 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8812 | /* |
| 8813 | * Unmute ADC0-2 and set the default input to mic-in |
| 8814 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8815 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8816 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8817 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8818 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8819 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8820 | /* |
| 8821 | * Set up output mixers (0x0c - 0x0f) |
| 8822 | */ |
| 8823 | /* set vol=0 to output mixers */ |
| 8824 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8825 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8826 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8827 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8828 | /* set up input amps for analog loopback */ |
| 8829 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8830 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8831 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8832 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8833 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8834 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8835 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8836 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8837 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8838 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8839 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8840 | |
| 8841 | /* FIXME: use matrix-type input source selection */ |
| 8842 | /* 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] | 8843 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8844 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8845 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8846 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8847 | { } |
| 8848 | }; |
| 8849 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8850 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8851 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8852 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8853 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8854 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8855 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8856 | { } /* end */ |
| 8857 | }; |
| 8858 | |
| 8859 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8860 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8861 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8862 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8863 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8864 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8865 | { } /* end */ |
| 8866 | }; |
| 8867 | |
| 8868 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8869 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8870 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8871 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8872 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8873 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8874 | { } /* end */ |
| 8875 | }; |
| 8876 | |
| 8877 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8878 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8879 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8880 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8881 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8882 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8883 | { } /* end */ |
| 8884 | }; |
| 8885 | |
| 8886 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8887 | { 2, alc889A_mb31_ch2_init }, |
| 8888 | { 4, alc889A_mb31_ch4_init }, |
| 8889 | { 5, alc889A_mb31_ch5_init }, |
| 8890 | { 6, alc889A_mb31_ch6_init }, |
| 8891 | }; |
| 8892 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8893 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8894 | /* eanable EAPD on medion laptop */ |
| 8895 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8896 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8897 | { } |
| 8898 | }; |
| 8899 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8900 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8901 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8902 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8903 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8904 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8905 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8906 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8907 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8908 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8909 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8910 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8911 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8912 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8913 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8914 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8915 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8916 | { } /* end */ |
| 8917 | }; |
| 8918 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8919 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8920 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8921 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8922 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8923 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8924 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8925 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8926 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8927 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8928 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8929 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8930 | { } /* end */ |
| 8931 | }; |
| 8932 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8933 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8934 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8935 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8936 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8937 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8939 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8940 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8941 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8942 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8943 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8944 | { } /* end */ |
| 8945 | }; |
| 8946 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8947 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8948 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8949 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8950 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8951 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8952 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8953 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8954 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8955 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8956 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8957 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8958 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8959 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8960 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8961 | { } /* end */ |
| 8962 | }; |
| 8963 | |
| 8964 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8965 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8966 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8967 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8968 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8969 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8970 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8971 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8972 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8973 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8974 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8975 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8976 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8977 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8978 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8979 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8981 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8982 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8983 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8984 | { } /* end */ |
| 8985 | }; |
| 8986 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8987 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8988 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8989 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8990 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8991 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8992 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8993 | HDA_OUTPUT), |
| 8994 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8995 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8996 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8997 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8998 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8999 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9000 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9001 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9002 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9003 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9005 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9006 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9007 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9008 | { } /* end */ |
| 9009 | }; |
| 9010 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9011 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 9012 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9013 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9014 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9015 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9016 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9017 | HDA_OUTPUT), |
| 9018 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9019 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9020 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9021 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9022 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9023 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9024 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9025 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9026 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9027 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9028 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 9029 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9030 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9031 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9032 | { } /* end */ |
| 9033 | }; |
| 9034 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 9035 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9036 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9037 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9038 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9039 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9040 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9041 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9042 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9043 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9044 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9045 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9046 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9047 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9048 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9049 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9050 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9051 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9052 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9053 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9054 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9055 | { } /* end */ |
| 9056 | }; |
| 9057 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9058 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9059 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9060 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9061 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9062 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9063 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9064 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9065 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9066 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9067 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9068 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9069 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9070 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9071 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9072 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9073 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9074 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9075 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9076 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9077 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9078 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9079 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9080 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9081 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9082 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9083 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9084 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9085 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9086 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9087 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9088 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9089 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9090 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9091 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9092 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9093 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9094 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9095 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 9096 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9097 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9098 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9099 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9100 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9101 | { } /* end */ |
| 9102 | }; |
| 9103 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9104 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9105 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9106 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9107 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9108 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9109 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9110 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9111 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9112 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9113 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9114 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9115 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9116 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9117 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9118 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9119 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9120 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9121 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9122 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9124 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9125 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9126 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9127 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9128 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9129 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9131 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9132 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9133 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9134 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9135 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9136 | { } /* end */ |
| 9137 | }; |
| 9138 | |
| 9139 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9140 | /* Unmute front mixer */ |
| 9141 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9142 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9143 | |
| 9144 | /* Set speaker pin to front mixer */ |
| 9145 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9146 | |
| 9147 | /* Init headphone pin */ |
| 9148 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9149 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9150 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9151 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9152 | |
| 9153 | { } /* end */ |
| 9154 | }; |
| 9155 | |
| 9156 | /* toggle speaker-output according to the hp-jack state */ |
| 9157 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9158 | { |
| 9159 | struct alc_spec *spec = codec->spec; |
| 9160 | |
| 9161 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9162 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9163 | } |
| 9164 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9165 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9166 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9167 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9168 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9169 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9170 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9171 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9172 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9173 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9174 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9175 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9176 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9177 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9178 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9179 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9180 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9181 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9182 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9183 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9184 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9185 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9186 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9187 | { } /* end */ |
| 9188 | }; |
| 9189 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9190 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9191 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9192 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9193 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9194 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9195 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9196 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9197 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9198 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9199 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9200 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9201 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9202 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9203 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9204 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9205 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9206 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9207 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9208 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9209 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9210 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9211 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9212 | { } /* end */ |
| 9213 | }; |
| 9214 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9215 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9216 | /* Output mixers */ |
| 9217 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9218 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9219 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9220 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9221 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9222 | HDA_OUTPUT), |
| 9223 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9224 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9225 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9226 | /* Output switches */ |
| 9227 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9228 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9229 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9230 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9231 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9232 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9233 | /* Input mixers */ |
| 9234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9236 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9237 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9238 | { } /* end */ |
| 9239 | }; |
| 9240 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9241 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9242 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9243 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9244 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9245 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9246 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9247 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9248 | { } /* end */ |
| 9249 | }; |
| 9250 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9251 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9252 | .ops = &snd_hda_bind_vol, |
| 9253 | .values = { |
| 9254 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9255 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9256 | 0 |
| 9257 | }, |
| 9258 | }; |
| 9259 | |
| 9260 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9261 | .ops = &snd_hda_bind_sw, |
| 9262 | .values = { |
| 9263 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9264 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9265 | 0 |
| 9266 | }, |
| 9267 | }; |
| 9268 | |
| 9269 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9270 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9271 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9272 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9273 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9274 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9275 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9276 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9277 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9278 | { } /* end */ |
| 9279 | }; |
| 9280 | |
| 9281 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9282 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9283 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9284 | { |
| 9285 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9286 | /* .name = "Capture Source", */ |
| 9287 | .name = "Input Source", |
| 9288 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9289 | .info = alc_mux_enum_info, |
| 9290 | .get = alc_mux_enum_get, |
| 9291 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9292 | }, |
| 9293 | { } /* end */ |
| 9294 | }; |
| 9295 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9296 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9297 | { |
| 9298 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9299 | .name = "Channel Mode", |
| 9300 | .info = alc_ch_mode_info, |
| 9301 | .get = alc_ch_mode_get, |
| 9302 | .put = alc_ch_mode_put, |
| 9303 | }, |
| 9304 | { } /* end */ |
| 9305 | }; |
| 9306 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9307 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9308 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9309 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9310 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9311 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9312 | spec->autocfg.hp_pins[0] = 0x15; |
| 9313 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9314 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9315 | } |
| 9316 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9317 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9318 | /* HP */ |
| 9319 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9320 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9321 | /* Subwoofer */ |
| 9322 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9323 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9324 | |
| 9325 | /* enable unsolicited event */ |
| 9326 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9327 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9328 | |
| 9329 | { } /* end */ |
| 9330 | }; |
| 9331 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9332 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9333 | /* HP */ |
| 9334 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9335 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9336 | /* Int speaker */ |
| 9337 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9338 | |
| 9339 | /* enable unsolicited event */ |
| 9340 | /* |
| 9341 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9342 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9343 | */ |
| 9344 | |
| 9345 | { } /* end */ |
| 9346 | }; |
| 9347 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9348 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9349 | /* HP */ |
| 9350 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9351 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9352 | /* Int speaker */ |
| 9353 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9354 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9355 | |
| 9356 | /* enable unsolicited event */ |
| 9357 | {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] | 9358 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9359 | |
| 9360 | { } /* end */ |
| 9361 | }; |
| 9362 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9363 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9364 | /* HP */ |
| 9365 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9366 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9367 | /* Subwoofer */ |
| 9368 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9369 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9370 | |
| 9371 | /* enable unsolicited event */ |
| 9372 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9373 | |
| 9374 | { } /* end */ |
| 9375 | }; |
| 9376 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9377 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9378 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9379 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9380 | |
| 9381 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9382 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9383 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9384 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9385 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9386 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9387 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9388 | /* Connect Mic jack to CLFE */ |
| 9389 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9390 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9391 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9392 | /* Connect Line-in jack to Surround */ |
| 9393 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9394 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9395 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9396 | /* Connect HP out jack to Front */ |
| 9397 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9398 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9399 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9400 | |
| 9401 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9402 | |
| 9403 | { } /* end */ |
| 9404 | }; |
| 9405 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9406 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9407 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9408 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9409 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9410 | { } /* end */ |
| 9411 | }; |
| 9412 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9413 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9414 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9415 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9416 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9417 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9418 | { } /* end */ |
| 9419 | }; |
| 9420 | |
| 9421 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9422 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9423 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9424 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9425 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9426 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9427 | { } /* end */ |
| 9428 | }; |
| 9429 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9430 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9431 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9433 | |
| 9434 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9435 | |
| 9436 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9437 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9438 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9439 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9440 | { } /* end */ |
| 9441 | }; |
| 9442 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9443 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9444 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9445 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9446 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9447 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9448 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9449 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9450 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9451 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9452 | { } /* end */ |
| 9453 | }; |
| 9454 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9455 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9456 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9457 | { } |
| 9458 | }; |
| 9459 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9460 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9461 | /* HP */ |
| 9462 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9463 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9464 | |
| 9465 | /* enable unsolicited event */ |
| 9466 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9467 | |
| 9468 | { } /* end */ |
| 9469 | }; |
| 9470 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9471 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9472 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9473 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9474 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9475 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9476 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9477 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9478 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9479 | } |
| 9480 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9481 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9482 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9483 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9484 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9485 | {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] | 9486 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9487 | }; |
| 9488 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9489 | /* |
| 9490 | * 2ch mode |
| 9491 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9492 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9493 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9494 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9495 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9496 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9497 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9498 | }; |
| 9499 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9500 | /* |
| 9501 | * 4ch mode |
| 9502 | */ |
| 9503 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9504 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9505 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9506 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9507 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9508 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9509 | { } /* end */ |
| 9510 | }; |
| 9511 | |
| 9512 | /* |
| 9513 | * 6ch mode |
| 9514 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9515 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9516 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9517 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9518 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9519 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9520 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9521 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9522 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9523 | }; |
| 9524 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9525 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9526 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9527 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9528 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9529 | }; |
| 9530 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9531 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9532 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9533 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9534 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9535 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9536 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9537 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9538 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9539 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9540 | } |
| 9541 | |
| 9542 | /* toggle RCA according to the front-jack state */ |
| 9543 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9544 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9545 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9546 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9547 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9548 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9549 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9550 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9551 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9552 | unsigned int res) |
| 9553 | { |
| 9554 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9555 | alc888_lenovo_ms7195_front_automute(codec); |
| 9556 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9557 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9558 | } |
| 9559 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9560 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9561 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9562 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9563 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9564 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9565 | spec->autocfg.hp_pins[0] = 0x14; |
| 9566 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9567 | } |
| 9568 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9569 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9570 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9571 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9572 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9573 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9574 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9575 | struct alc_spec *spec = codec->spec; |
| 9576 | |
| 9577 | spec->autocfg.hp_pins[0] = 0x15; |
| 9578 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9579 | } |
| 9580 | |
| 9581 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9582 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9583 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9584 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9585 | } |
| 9586 | |
| 9587 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9588 | unsigned int res) |
| 9589 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9590 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9591 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9592 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9593 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9594 | default: |
| 9595 | alc_automute_amp_unsol_event(codec, res); |
| 9596 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9597 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9598 | } |
| 9599 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9600 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9601 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9602 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9603 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9604 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9605 | spec->autocfg.hp_pins[0] = 0x14; |
| 9606 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9607 | } |
| 9608 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9609 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9610 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9611 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9612 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9613 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9614 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9615 | } |
| 9616 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9617 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9618 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9619 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9620 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9621 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9622 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9623 | } |
| 9624 | |
| 9625 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9626 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9627 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9628 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9629 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9630 | HDA_AMP_MUTE, bits); |
| 9631 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9632 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9633 | } |
| 9634 | |
| 9635 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9636 | unsigned int res) |
| 9637 | { |
| 9638 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9639 | alc883_lenovo_101e_all_automute(codec); |
| 9640 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9641 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9642 | } |
| 9643 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9644 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9645 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9646 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9647 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9648 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9649 | spec->autocfg.hp_pins[0] = 0x14; |
| 9650 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9651 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9652 | } |
| 9653 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9654 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9655 | /* HP Pin: output 0 (0x0c) */ |
| 9656 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9657 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9658 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9659 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9660 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9661 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9662 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9663 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9664 | /* eanable EAPD on medion laptop */ |
| 9665 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9666 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9667 | /* enable unsolicited event */ |
| 9668 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9669 | { } |
| 9670 | }; |
| 9671 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9672 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9673 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9674 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9675 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9676 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9677 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9678 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9679 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9680 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9681 | } |
| 9682 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9683 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9684 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9685 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9686 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9687 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9688 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9689 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9690 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9691 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9692 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9693 | } |
| 9694 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9695 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9696 | { |
| 9697 | struct alc_spec *spec = codec->spec; |
| 9698 | |
| 9699 | spec->autocfg.hp_pins[0] = 0x15; |
| 9700 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9701 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9702 | } |
| 9703 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9704 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9705 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9706 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9708 | /* enable unsolicited event */ |
| 9709 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9710 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9711 | { } /* end */ |
| 9712 | }; |
| 9713 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9714 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9715 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9716 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9717 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9718 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9719 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9720 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9721 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9722 | spec->ext_mic.pin = 0x18; |
| 9723 | spec->int_mic.pin = 0x19; |
| 9724 | spec->ext_mic.mux_idx = 0; |
| 9725 | spec->int_mic.mux_idx = 1; |
| 9726 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9727 | } |
| 9728 | |
| 9729 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9730 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9731 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9732 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9733 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9734 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9735 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9736 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9737 | /* enable unsolicited event */ |
| 9738 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9739 | { } /* end */ |
| 9740 | }; |
| 9741 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9742 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9743 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9744 | struct alc_spec *spec = codec->spec; |
| 9745 | |
| 9746 | spec->autocfg.hp_pins[0] = 0x14; |
| 9747 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9748 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9749 | } |
| 9750 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9751 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9752 | /* Init rear pin (used as headphone output) */ |
| 9753 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9754 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9755 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9756 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9757 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9758 | /* Init line 2 pin (used as headphone out by default) */ |
| 9759 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9760 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9761 | { } /* end */ |
| 9762 | }; |
| 9763 | |
| 9764 | /* Mute speakers according to the headphone jack state */ |
| 9765 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9766 | { |
| 9767 | unsigned int present; |
| 9768 | |
| 9769 | /* Mute only in 2ch or 4ch mode */ |
| 9770 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9771 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9772 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9773 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9774 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9775 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9776 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9777 | } |
| 9778 | } |
| 9779 | |
| 9780 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9781 | { |
| 9782 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9783 | alc889A_mb31_automute(codec); |
| 9784 | } |
| 9785 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9786 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9787 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9788 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9789 | #endif |
| 9790 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9791 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9792 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9793 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9794 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9795 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9796 | |
| 9797 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9798 | ALC1200_DIGOUT_NID, 0, |
| 9799 | }; |
| 9800 | |
| 9801 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9802 | ALC883_DIGOUT_NID, 0, |
| 9803 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9804 | |
| 9805 | /* |
| 9806 | * configuration and preset |
| 9807 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 9808 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9809 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9810 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9811 | [ALC882_ARIMA] = "arima", |
| 9812 | [ALC882_W2JC] = "w2jc", |
| 9813 | [ALC882_TARGA] = "targa", |
| 9814 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9815 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9816 | [ALC885_MACPRO] = "macpro", |
| 9817 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9818 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9819 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9820 | [ALC885_MBP3] = "mbp3", |
| 9821 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9822 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9823 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9824 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9825 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9826 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9827 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9828 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9829 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9830 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9831 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9832 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9833 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9834 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9835 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9836 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9837 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9838 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9839 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9840 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9841 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9842 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9843 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9844 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9845 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9846 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9847 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9848 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9849 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9850 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9851 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9852 | [ALC889A_INTEL] = "intel-alc889a", |
| 9853 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9854 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9855 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9856 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9857 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9858 | }; |
| 9859 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9860 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9861 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9862 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9863 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9864 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9865 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9866 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9867 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9868 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9869 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9870 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9871 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9872 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9873 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9874 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9875 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9876 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9877 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9878 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9879 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9880 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9881 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9882 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9883 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9884 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9885 | /* default Acer -- disabled as it causes more problems. |
| 9886 | * model=auto should work fine now |
| 9887 | */ |
| 9888 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9889 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9890 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9891 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9892 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9893 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9894 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9895 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9896 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9897 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9898 | |
| 9899 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9900 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9901 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9902 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9903 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9904 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9905 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9906 | 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] | 9907 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9908 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9909 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9910 | |
| 9911 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9912 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9913 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9914 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9915 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9916 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9917 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9918 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9919 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9920 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9921 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9922 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9923 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9924 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9925 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9926 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9927 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9928 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9929 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9930 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9931 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9932 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9933 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9934 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9935 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9936 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9937 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9938 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9939 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9940 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9941 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9942 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9943 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9944 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9945 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9946 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9947 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9948 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9949 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9950 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9951 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9952 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9953 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9954 | 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] | 9955 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9956 | 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] | 9957 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9958 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9959 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9960 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9961 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9962 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9963 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9964 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9965 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9966 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9967 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9968 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9969 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9970 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9971 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9972 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9973 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9974 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9975 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9976 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9977 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9978 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9979 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9980 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9981 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9982 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9983 | {} |
| 9984 | }; |
| 9985 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9986 | /* codec SSID table for Intel Mac */ |
| 9987 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9988 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9989 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9990 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9991 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9992 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9993 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9994 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9995 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9996 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), |
Justin P. Mattock | f53dae2 | 2010-06-06 16:09:51 -0700 | [diff] [blame] | 9997 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9998 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9999 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 10000 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 10001 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10002 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10003 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 10004 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10005 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 10006 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10007 | */ |
| 10008 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10009 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10010 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10011 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10012 | }; |
| 10013 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10014 | static struct alc_config_preset alc882_presets[] = { |
| 10015 | [ALC882_3ST_DIG] = { |
| 10016 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10017 | .init_verbs = { alc882_base_init_verbs, |
| 10018 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10019 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10020 | .dac_nids = alc882_dac_nids, |
| 10021 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10022 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10023 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10024 | .channel_mode = alc882_ch_modes, |
| 10025 | .need_dac_fix = 1, |
| 10026 | .input_mux = &alc882_capture_source, |
| 10027 | }, |
| 10028 | [ALC882_6ST_DIG] = { |
| 10029 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10030 | .init_verbs = { alc882_base_init_verbs, |
| 10031 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10032 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10033 | .dac_nids = alc882_dac_nids, |
| 10034 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10035 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10036 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10037 | .channel_mode = alc882_sixstack_modes, |
| 10038 | .input_mux = &alc882_capture_source, |
| 10039 | }, |
| 10040 | [ALC882_ARIMA] = { |
| 10041 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10042 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10043 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10044 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10045 | .dac_nids = alc882_dac_nids, |
| 10046 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10047 | .channel_mode = alc882_sixstack_modes, |
| 10048 | .input_mux = &alc882_capture_source, |
| 10049 | }, |
| 10050 | [ALC882_W2JC] = { |
| 10051 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10052 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10053 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10054 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10055 | .dac_nids = alc882_dac_nids, |
| 10056 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10057 | .channel_mode = alc880_threestack_modes, |
| 10058 | .need_dac_fix = 1, |
| 10059 | .input_mux = &alc882_capture_source, |
| 10060 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10061 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10062 | [ALC885_MBA21] = { |
| 10063 | .mixers = { alc885_mba21_mixer }, |
| 10064 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10065 | .num_dacs = 2, |
| 10066 | .dac_nids = alc882_dac_nids, |
| 10067 | .channel_mode = alc885_mba21_ch_modes, |
| 10068 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10069 | .input_mux = &alc882_capture_source, |
| 10070 | .unsol_event = alc_automute_amp_unsol_event, |
| 10071 | .setup = alc885_mba21_setup, |
| 10072 | .init_hook = alc_automute_amp, |
| 10073 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10074 | [ALC885_MBP3] = { |
| 10075 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10076 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10077 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10078 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10079 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10080 | .hp_nid = 0x04, |
| 10081 | .channel_mode = alc885_mbp_4ch_modes, |
| 10082 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10083 | .input_mux = &alc882_capture_source, |
| 10084 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10085 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10086 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10087 | .setup = alc885_mbp3_setup, |
| 10088 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10089 | }, |
| 10090 | [ALC885_MB5] = { |
| 10091 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10092 | .init_verbs = { alc885_mb5_init_verbs, |
| 10093 | alc880_gpio1_init_verbs }, |
| 10094 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10095 | .dac_nids = alc882_dac_nids, |
| 10096 | .channel_mode = alc885_mb5_6ch_modes, |
| 10097 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10098 | .input_mux = &mb5_capture_source, |
| 10099 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10100 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10101 | .unsol_event = alc_automute_amp_unsol_event, |
| 10102 | .setup = alc885_mb5_setup, |
| 10103 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10104 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10105 | [ALC885_MACMINI3] = { |
| 10106 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10107 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10108 | alc880_gpio1_init_verbs }, |
| 10109 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10110 | .dac_nids = alc882_dac_nids, |
| 10111 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10112 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10113 | .input_mux = &macmini3_capture_source, |
| 10114 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10115 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10116 | .unsol_event = alc_automute_amp_unsol_event, |
| 10117 | .setup = alc885_macmini3_setup, |
| 10118 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10119 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10120 | [ALC885_MACPRO] = { |
| 10121 | .mixers = { alc882_macpro_mixer }, |
| 10122 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10123 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10124 | .dac_nids = alc882_dac_nids, |
| 10125 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10126 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10127 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10128 | .channel_mode = alc882_ch_modes, |
| 10129 | .input_mux = &alc882_capture_source, |
| 10130 | .init_hook = alc885_macpro_init_hook, |
| 10131 | }, |
| 10132 | [ALC885_IMAC24] = { |
| 10133 | .mixers = { alc885_imac24_mixer }, |
| 10134 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10135 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10136 | .dac_nids = alc882_dac_nids, |
| 10137 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10138 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10139 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10140 | .channel_mode = alc882_ch_modes, |
| 10141 | .input_mux = &alc882_capture_source, |
| 10142 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10143 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10144 | .init_hook = alc885_imac24_init_hook, |
| 10145 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10146 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10147 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10148 | .init_verbs = { alc885_imac91_init_verbs, |
| 10149 | alc880_gpio1_init_verbs }, |
| 10150 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10151 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10152 | .channel_mode = alc885_mba21_ch_modes, |
| 10153 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10154 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10155 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10156 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10157 | .unsol_event = alc_automute_amp_unsol_event, |
| 10158 | .setup = alc885_imac91_setup, |
| 10159 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10160 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10161 | [ALC882_TARGA] = { |
| 10162 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10163 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10164 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10165 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10166 | .dac_nids = alc882_dac_nids, |
| 10167 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10168 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10169 | .adc_nids = alc882_adc_nids, |
| 10170 | .capsrc_nids = alc882_capsrc_nids, |
| 10171 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10172 | .channel_mode = alc882_3ST_6ch_modes, |
| 10173 | .need_dac_fix = 1, |
| 10174 | .input_mux = &alc882_capture_source, |
| 10175 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10176 | .setup = alc882_targa_setup, |
| 10177 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10178 | }, |
| 10179 | [ALC882_ASUS_A7J] = { |
| 10180 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10181 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10182 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10183 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10184 | .dac_nids = alc882_dac_nids, |
| 10185 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10186 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10187 | .adc_nids = alc882_adc_nids, |
| 10188 | .capsrc_nids = alc882_capsrc_nids, |
| 10189 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10190 | .channel_mode = alc882_3ST_6ch_modes, |
| 10191 | .need_dac_fix = 1, |
| 10192 | .input_mux = &alc882_capture_source, |
| 10193 | }, |
| 10194 | [ALC882_ASUS_A7M] = { |
| 10195 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10196 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10197 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10198 | alc882_asus_a7m_verbs }, |
| 10199 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10200 | .dac_nids = alc882_dac_nids, |
| 10201 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10202 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10203 | .channel_mode = alc880_threestack_modes, |
| 10204 | .need_dac_fix = 1, |
| 10205 | .input_mux = &alc882_capture_source, |
| 10206 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10207 | [ALC883_3ST_2ch_DIG] = { |
| 10208 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10209 | .init_verbs = { alc883_init_verbs }, |
| 10210 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10211 | .dac_nids = alc883_dac_nids, |
| 10212 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10213 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10214 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10215 | .channel_mode = alc883_3ST_2ch_modes, |
| 10216 | .input_mux = &alc883_capture_source, |
| 10217 | }, |
| 10218 | [ALC883_3ST_6ch_DIG] = { |
| 10219 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10220 | .init_verbs = { alc883_init_verbs }, |
| 10221 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10222 | .dac_nids = alc883_dac_nids, |
| 10223 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10224 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10225 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10226 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10227 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10228 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10229 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10230 | [ALC883_3ST_6ch] = { |
| 10231 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10232 | .init_verbs = { alc883_init_verbs }, |
| 10233 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10234 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10235 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10236 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10237 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10238 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10239 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10240 | [ALC883_3ST_6ch_INTEL] = { |
| 10241 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10242 | .init_verbs = { alc883_init_verbs }, |
| 10243 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10244 | .dac_nids = alc883_dac_nids, |
| 10245 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10246 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10247 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10248 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10249 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10250 | .need_dac_fix = 1, |
| 10251 | .input_mux = &alc883_3stack_6ch_intel, |
| 10252 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10253 | [ALC889A_INTEL] = { |
| 10254 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10255 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10256 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10257 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10258 | .dac_nids = alc883_dac_nids, |
| 10259 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10260 | .adc_nids = alc889_adc_nids, |
| 10261 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10262 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10263 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10264 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10265 | .channel_mode = alc889_8ch_intel_modes, |
| 10266 | .capsrc_nids = alc889_capsrc_nids, |
| 10267 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10268 | .setup = alc889_automute_setup, |
| 10269 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10270 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10271 | .need_dac_fix = 1, |
| 10272 | }, |
| 10273 | [ALC889_INTEL] = { |
| 10274 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10275 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10276 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10277 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10278 | .dac_nids = alc883_dac_nids, |
| 10279 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10280 | .adc_nids = alc889_adc_nids, |
| 10281 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10282 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10283 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10284 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10285 | .channel_mode = alc889_8ch_intel_modes, |
| 10286 | .capsrc_nids = alc889_capsrc_nids, |
| 10287 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10288 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10289 | .init_hook = alc889_intel_init_hook, |
| 10290 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10291 | .need_dac_fix = 1, |
| 10292 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10293 | [ALC883_6ST_DIG] = { |
| 10294 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10295 | .init_verbs = { alc883_init_verbs }, |
| 10296 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10297 | .dac_nids = alc883_dac_nids, |
| 10298 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10299 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10300 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10301 | .channel_mode = alc883_sixstack_modes, |
| 10302 | .input_mux = &alc883_capture_source, |
| 10303 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10304 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10305 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10306 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10307 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10308 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10309 | .dac_nids = alc883_dac_nids, |
| 10310 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10311 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10312 | .channel_mode = alc883_3ST_6ch_modes, |
| 10313 | .need_dac_fix = 1, |
| 10314 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10315 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10316 | .setup = alc882_targa_setup, |
| 10317 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10318 | }, |
| 10319 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10320 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10321 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10322 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10323 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10324 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10325 | .adc_nids = alc883_adc_nids_alt, |
| 10326 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10327 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10328 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10329 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10330 | .channel_mode = alc883_3ST_2ch_modes, |
| 10331 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10332 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10333 | .setup = alc882_targa_setup, |
| 10334 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10335 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10336 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10337 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10338 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10339 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10340 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10341 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10342 | .dac_nids = alc883_dac_nids, |
| 10343 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10344 | .adc_nids = alc883_adc_nids_rev, |
| 10345 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10346 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10347 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10348 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10349 | .channel_mode = alc883_4ST_8ch_modes, |
| 10350 | .need_dac_fix = 1, |
| 10351 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10352 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10353 | .setup = alc882_targa_setup, |
| 10354 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10355 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10356 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10357 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10358 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10359 | * and the headphone jack. Turn this on and rely on the |
| 10360 | * standard mute methods whenever the user wants to turn |
| 10361 | * these outputs off. |
| 10362 | */ |
| 10363 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10364 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10365 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10366 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10367 | .channel_mode = alc883_3ST_2ch_modes, |
| 10368 | .input_mux = &alc883_capture_source, |
| 10369 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10370 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10371 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10372 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10373 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10374 | .dac_nids = alc883_dac_nids, |
| 10375 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10376 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10377 | .channel_mode = alc883_3ST_2ch_modes, |
| 10378 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10379 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10380 | .setup = alc883_acer_aspire_setup, |
| 10381 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10382 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10383 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 10384 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10385 | alc883_chmode_mixer }, |
| 10386 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10387 | alc888_acer_aspire_4930g_verbs }, |
| 10388 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10389 | .dac_nids = alc883_dac_nids, |
| 10390 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10391 | .adc_nids = alc883_adc_nids_rev, |
| 10392 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10393 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10394 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10395 | .channel_mode = alc883_3ST_6ch_modes, |
| 10396 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10397 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10398 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10399 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10400 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10401 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10402 | .setup = alc888_acer_aspire_4930g_setup, |
| 10403 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10404 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10405 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10406 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10407 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10408 | alc888_acer_aspire_6530g_verbs }, |
| 10409 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10410 | .dac_nids = alc883_dac_nids, |
| 10411 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10412 | .adc_nids = alc883_adc_nids_rev, |
| 10413 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10414 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10415 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10416 | .channel_mode = alc883_3ST_2ch_modes, |
| 10417 | .num_mux_defs = |
| 10418 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10419 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10420 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10421 | .setup = alc888_acer_aspire_6530g_setup, |
| 10422 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10423 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10424 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10425 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10426 | alc883_chmode_mixer }, |
| 10427 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10428 | alc889_acer_aspire_8930g_verbs, |
| 10429 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10430 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10431 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10432 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10433 | .adc_nids = alc889_adc_nids, |
| 10434 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10435 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10436 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10437 | .channel_mode = alc883_3ST_6ch_modes, |
| 10438 | .need_dac_fix = 1, |
| 10439 | .const_channel_count = 6, |
| 10440 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10441 | ARRAY_SIZE(alc889_capture_sources), |
| 10442 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10443 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10444 | .setup = alc889_acer_aspire_8930g_setup, |
| 10445 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10446 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10447 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10448 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10449 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10450 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10451 | .mixers = { alc883_3ST_6ch_mixer, |
| 10452 | alc883_chmode_mixer }, |
| 10453 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10454 | alc888_acer_aspire_7730G_verbs }, |
| 10455 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10456 | .dac_nids = alc883_dac_nids, |
| 10457 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10458 | .adc_nids = alc883_adc_nids_rev, |
| 10459 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10460 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10461 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10462 | .channel_mode = alc883_3ST_6ch_modes, |
| 10463 | .need_dac_fix = 1, |
| 10464 | .const_channel_count = 6, |
| 10465 | .input_mux = &alc883_capture_source, |
| 10466 | .unsol_event = alc_automute_amp_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10467 | .setup = alc888_acer_aspire_7730g_setup, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10468 | .init_hook = alc_automute_amp, |
| 10469 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10470 | [ALC883_MEDION] = { |
| 10471 | .mixers = { alc883_fivestack_mixer, |
| 10472 | alc883_chmode_mixer }, |
| 10473 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10474 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10475 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10476 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10477 | .adc_nids = alc883_adc_nids_alt, |
| 10478 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10479 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10480 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10481 | .channel_mode = alc883_sixstack_modes, |
| 10482 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10483 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10484 | [ALC883_MEDION_WIM2160] = { |
| 10485 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10486 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10487 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10488 | .dac_nids = alc883_dac_nids, |
| 10489 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10490 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10491 | .adc_nids = alc883_adc_nids, |
| 10492 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10493 | .channel_mode = alc883_3ST_2ch_modes, |
| 10494 | .input_mux = &alc883_capture_source, |
| 10495 | .unsol_event = alc_automute_amp_unsol_event, |
| 10496 | .setup = alc883_medion_wim2160_setup, |
| 10497 | .init_hook = alc_automute_amp, |
| 10498 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10499 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10500 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10501 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10502 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10503 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10504 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10505 | .channel_mode = alc883_3ST_2ch_modes, |
| 10506 | .input_mux = &alc883_capture_source, |
| 10507 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10508 | [ALC883_CLEVO_M540R] = { |
| 10509 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10510 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10511 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10512 | .dac_nids = alc883_dac_nids, |
| 10513 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10514 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10515 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10516 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10517 | .need_dac_fix = 1, |
| 10518 | .input_mux = &alc883_capture_source, |
| 10519 | /* This machine has the hardware HP auto-muting, thus |
| 10520 | * we need no software mute via unsol event |
| 10521 | */ |
| 10522 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10523 | [ALC883_CLEVO_M720] = { |
| 10524 | .mixers = { alc883_clevo_m720_mixer }, |
| 10525 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10526 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10527 | .dac_nids = alc883_dac_nids, |
| 10528 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10529 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10530 | .channel_mode = alc883_3ST_2ch_modes, |
| 10531 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10532 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10533 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10534 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10535 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10536 | [ALC883_LENOVO_101E_2ch] = { |
| 10537 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10538 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10539 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10540 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10541 | .adc_nids = alc883_adc_nids_alt, |
| 10542 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10543 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10544 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10545 | .channel_mode = alc883_3ST_2ch_modes, |
| 10546 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10547 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10548 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10549 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10550 | [ALC883_LENOVO_NB0763] = { |
| 10551 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10552 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10553 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10554 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10555 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10556 | .channel_mode = alc883_3ST_2ch_modes, |
| 10557 | .need_dac_fix = 1, |
| 10558 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10559 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10560 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10561 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10562 | }, |
| 10563 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10564 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10565 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10566 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10567 | .dac_nids = alc883_dac_nids, |
| 10568 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10569 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10570 | .channel_mode = alc883_3ST_6ch_modes, |
| 10571 | .need_dac_fix = 1, |
| 10572 | .input_mux = &alc883_capture_source, |
| 10573 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10574 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10575 | }, |
| 10576 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10577 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10578 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10579 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10580 | .dac_nids = alc883_dac_nids, |
| 10581 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10582 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10583 | .channel_mode = alc883_3ST_2ch_modes, |
| 10584 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10585 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10586 | .setup = alc883_haier_w66_setup, |
| 10587 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10588 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10589 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10590 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10591 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10592 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10593 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10594 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10595 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10596 | .need_dac_fix = 1, |
| 10597 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10598 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10599 | .setup = alc888_3st_hp_setup, |
| 10600 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10601 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10602 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10603 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10604 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10605 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10606 | .dac_nids = alc883_dac_nids, |
| 10607 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10608 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10609 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10610 | .channel_mode = alc883_sixstack_modes, |
| 10611 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10612 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10613 | .setup = alc888_6st_dell_setup, |
| 10614 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10615 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10616 | [ALC883_MITAC] = { |
| 10617 | .mixers = { alc883_mitac_mixer }, |
| 10618 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10619 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10620 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10621 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10622 | .channel_mode = alc883_3ST_2ch_modes, |
| 10623 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10624 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10625 | .setup = alc883_mitac_setup, |
| 10626 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10627 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10628 | [ALC883_FUJITSU_PI2515] = { |
| 10629 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10630 | .init_verbs = { alc883_init_verbs, |
| 10631 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10632 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10633 | .dac_nids = alc883_dac_nids, |
| 10634 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10635 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10636 | .channel_mode = alc883_3ST_2ch_modes, |
| 10637 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10638 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10639 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10640 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10641 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10642 | [ALC888_FUJITSU_XA3530] = { |
| 10643 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10644 | .init_verbs = { alc883_init_verbs, |
| 10645 | alc888_fujitsu_xa3530_verbs }, |
| 10646 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10647 | .dac_nids = alc883_dac_nids, |
| 10648 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10649 | .adc_nids = alc883_adc_nids_rev, |
| 10650 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10651 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10652 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10653 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10654 | .num_mux_defs = |
| 10655 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10656 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10657 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10658 | .setup = alc888_fujitsu_xa3530_setup, |
| 10659 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10660 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10661 | [ALC888_LENOVO_SKY] = { |
| 10662 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10663 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10664 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10665 | .dac_nids = alc883_dac_nids, |
| 10666 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10667 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10668 | .channel_mode = alc883_sixstack_modes, |
| 10669 | .need_dac_fix = 1, |
| 10670 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10671 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10672 | .setup = alc888_lenovo_sky_setup, |
| 10673 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10674 | }, |
| 10675 | [ALC888_ASUS_M90V] = { |
| 10676 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10677 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10678 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10679 | .dac_nids = alc883_dac_nids, |
| 10680 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10681 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10682 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10683 | .channel_mode = alc883_3ST_6ch_modes, |
| 10684 | .need_dac_fix = 1, |
| 10685 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10686 | .unsol_event = alc_sku_unsol_event, |
| 10687 | .setup = alc883_mode2_setup, |
| 10688 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10689 | }, |
| 10690 | [ALC888_ASUS_EEE1601] = { |
| 10691 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10692 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10693 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10694 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10695 | .dac_nids = alc883_dac_nids, |
| 10696 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10697 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10698 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10699 | .channel_mode = alc883_3ST_2ch_modes, |
| 10700 | .need_dac_fix = 1, |
| 10701 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10702 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10703 | .init_hook = alc883_eee1601_inithook, |
| 10704 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10705 | [ALC1200_ASUS_P5Q] = { |
| 10706 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10707 | .init_verbs = { alc883_init_verbs }, |
| 10708 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10709 | .dac_nids = alc883_dac_nids, |
| 10710 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10711 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10712 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10713 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10714 | .channel_mode = alc883_sixstack_modes, |
| 10715 | .input_mux = &alc883_capture_source, |
| 10716 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10717 | [ALC889A_MB31] = { |
| 10718 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10719 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10720 | alc880_gpio1_init_verbs }, |
| 10721 | .adc_nids = alc883_adc_nids, |
| 10722 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10723 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10724 | .dac_nids = alc883_dac_nids, |
| 10725 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10726 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10727 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10728 | .input_mux = &alc889A_mb31_capture_source, |
| 10729 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10730 | .unsol_event = alc889A_mb31_unsol_event, |
| 10731 | .init_hook = alc889A_mb31_automute, |
| 10732 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10733 | [ALC883_SONY_VAIO_TT] = { |
| 10734 | .mixers = { alc883_vaiott_mixer }, |
| 10735 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10736 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10737 | .dac_nids = alc883_dac_nids, |
| 10738 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10739 | .channel_mode = alc883_3ST_2ch_modes, |
| 10740 | .input_mux = &alc883_capture_source, |
| 10741 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10742 | .setup = alc883_vaiott_setup, |
| 10743 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10744 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10745 | }; |
| 10746 | |
| 10747 | |
| 10748 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10749 | * Pin config fixes |
| 10750 | */ |
| 10751 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10752 | PINFIX_ABIT_AW9D_MAX, |
| 10753 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10754 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10755 | }; |
| 10756 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10757 | static const struct alc_fixup alc882_fixups[] = { |
| 10758 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10759 | .type = ALC_FIXUP_PINS, |
| 10760 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10761 | { 0x15, 0x01080104 }, /* side */ |
| 10762 | { 0x16, 0x01011012 }, /* rear */ |
| 10763 | { 0x17, 0x01016011 }, /* clfe */ |
| 10764 | { } |
| 10765 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10766 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10767 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10768 | .type = ALC_FIXUP_VERBS, |
| 10769 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10770 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10771 | {} |
| 10772 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10773 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10774 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10775 | .type = ALC_FIXUP_SKU, |
| 10776 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10777 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10778 | }; |
| 10779 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10780 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10781 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10782 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10783 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10784 | {} |
| 10785 | }; |
| 10786 | |
| 10787 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10788 | * BIOS auto configuration |
| 10789 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10790 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10791 | const struct auto_pin_cfg *cfg) |
| 10792 | { |
| 10793 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10794 | } |
| 10795 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10796 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10797 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10798 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10799 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10800 | int idx; |
| 10801 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10802 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10803 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10804 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10805 | if (dac == 0x25) |
| 10806 | idx = 4; |
| 10807 | else if (dac >= 0x02 && dac <= 0x05) |
| 10808 | idx = dac - 2; |
| 10809 | else |
| 10810 | return; |
| 10811 | 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] | 10812 | } |
| 10813 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10814 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10815 | { |
| 10816 | struct alc_spec *spec = codec->spec; |
| 10817 | int i; |
| 10818 | |
| 10819 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10820 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10821 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10822 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10823 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10824 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10825 | } |
| 10826 | } |
| 10827 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10828 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10829 | { |
| 10830 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10831 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10832 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10833 | |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10834 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10835 | pin = spec->autocfg.hp_pins[i]; |
| 10836 | if (!pin) |
| 10837 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10838 | dac = spec->multiout.hp_nid; |
| 10839 | if (!dac) |
| 10840 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10841 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10842 | } |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10843 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10844 | pin = spec->autocfg.speaker_pins[i]; |
| 10845 | if (!pin) |
| 10846 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10847 | dac = spec->multiout.extra_out_nid[0]; |
| 10848 | if (!dac) |
| 10849 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10850 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10851 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10852 | } |
| 10853 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10854 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10855 | { |
| 10856 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10857 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10858 | int i; |
| 10859 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10860 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10861 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10862 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10863 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10864 | snd_hda_codec_write(codec, nid, 0, |
| 10865 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10866 | AMP_OUT_MUTE); |
| 10867 | } |
| 10868 | } |
| 10869 | |
| 10870 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10871 | { |
| 10872 | struct alc_spec *spec = codec->spec; |
| 10873 | int c; |
| 10874 | |
| 10875 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10876 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10877 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10878 | unsigned int mux_idx; |
| 10879 | const struct hda_input_mux *imux; |
| 10880 | int conns, mute, idx, item; |
| 10881 | |
| 10882 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10883 | ARRAY_SIZE(conn_list)); |
| 10884 | if (conns < 0) |
| 10885 | continue; |
| 10886 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10887 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10888 | if (!imux->num_items && mux_idx > 0) |
| 10889 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10890 | for (idx = 0; idx < conns; idx++) { |
| 10891 | /* if the current connection is the selected one, |
| 10892 | * unmute it as default - otherwise mute it |
| 10893 | */ |
| 10894 | mute = AMP_IN_MUTE(idx); |
| 10895 | for (item = 0; item < imux->num_items; item++) { |
| 10896 | if (imux->items[item].index == idx) { |
| 10897 | if (spec->cur_mux[c] == item) |
| 10898 | mute = AMP_IN_UNMUTE(idx); |
| 10899 | break; |
| 10900 | } |
| 10901 | } |
| 10902 | /* check if we have a selector or mixer |
| 10903 | * we could check for the widget type instead, but |
| 10904 | * just check for Amp-In presence (in case of mixer |
| 10905 | * without amp-in there is something wrong, this |
| 10906 | * function shouldn't be used or capsrc nid is wrong) |
| 10907 | */ |
| 10908 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10909 | snd_hda_codec_write(codec, nid, 0, |
| 10910 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10911 | mute); |
| 10912 | else if (mute != AMP_IN_MUTE(idx)) |
| 10913 | snd_hda_codec_write(codec, nid, 0, |
| 10914 | AC_VERB_SET_CONNECT_SEL, |
| 10915 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10916 | } |
| 10917 | } |
| 10918 | } |
| 10919 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10920 | /* add mic boosts if needed */ |
| 10921 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10922 | { |
| 10923 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10924 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10925 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10926 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10927 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10928 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10929 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10930 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10931 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10932 | break; |
| 10933 | nid = cfg->inputs[i].pin; |
| 10934 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10935 | const char *label; |
| 10936 | char boost_label[32]; |
| 10937 | |
| 10938 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 10939 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10940 | type_idx++; |
| 10941 | else |
| 10942 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10943 | prev_label = label; |
| 10944 | |
| 10945 | snprintf(boost_label, sizeof(boost_label), |
| 10946 | "%s Boost Volume", label); |
| 10947 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10948 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10949 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10950 | if (err < 0) |
| 10951 | return err; |
| 10952 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10953 | } |
| 10954 | return 0; |
| 10955 | } |
| 10956 | |
| 10957 | /* almost identical with ALC880 parser... */ |
| 10958 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10959 | { |
| 10960 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10961 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10962 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10963 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10964 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10965 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10966 | if (err < 0) |
| 10967 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10968 | if (!spec->autocfg.line_outs) |
| 10969 | return 0; /* can't find valid BIOS pin config */ |
| 10970 | |
| 10971 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10972 | if (err < 0) |
| 10973 | return err; |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 10974 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10975 | if (err < 0) |
| 10976 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10977 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10978 | "Headphone"); |
| 10979 | if (err < 0) |
| 10980 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10981 | err = alc880_auto_create_extra_out(spec, |
| 10982 | spec->autocfg.speaker_pins[0], |
| 10983 | "Speaker"); |
| 10984 | if (err < 0) |
| 10985 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10986 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10987 | if (err < 0) |
| 10988 | return err; |
| 10989 | |
| 10990 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10991 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10992 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10993 | |
| 10994 | if (spec->kctls.list) |
| 10995 | add_mixer(spec, spec->kctls.list); |
| 10996 | |
| 10997 | add_verb(spec, alc883_auto_init_verbs); |
| 10998 | /* if ADC 0x07 is available, initialize it, too */ |
| 10999 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 11000 | add_verb(spec, alc882_adc1_init_verbs); |
| 11001 | |
| 11002 | spec->num_mux_defs = 1; |
| 11003 | spec->input_mux = &spec->private_imux[0]; |
| 11004 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 11005 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11006 | |
| 11007 | err = alc_auto_add_mic_boost(codec); |
| 11008 | if (err < 0) |
| 11009 | return err; |
| 11010 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11011 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11012 | } |
| 11013 | |
| 11014 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11015 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11016 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11017 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11018 | alc882_auto_init_multi_out(codec); |
| 11019 | alc882_auto_init_hp_out(codec); |
| 11020 | alc882_auto_init_analog_input(codec); |
| 11021 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11022 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11023 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11024 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11025 | } |
| 11026 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11027 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11028 | { |
| 11029 | struct alc_spec *spec; |
| 11030 | int err, board_config; |
| 11031 | |
| 11032 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11033 | if (spec == NULL) |
| 11034 | return -ENOMEM; |
| 11035 | |
| 11036 | codec->spec = spec; |
| 11037 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11038 | switch (codec->vendor_id) { |
| 11039 | case 0x10ec0882: |
| 11040 | case 0x10ec0885: |
| 11041 | break; |
| 11042 | default: |
| 11043 | /* ALC883 and variants */ |
| 11044 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11045 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11046 | } |
| 11047 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11048 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 11049 | alc882_models, |
| 11050 | alc882_cfg_tbl); |
| 11051 | |
| 11052 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11053 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11054 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11055 | |
| 11056 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11057 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11058 | codec->chip_name); |
| 11059 | board_config = ALC882_AUTO; |
| 11060 | } |
| 11061 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11062 | if (board_config == ALC882_AUTO) { |
| 11063 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11064 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11065 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11066 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11067 | alc_auto_parse_customize_define(codec); |
| 11068 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11069 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11070 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11071 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11072 | if (err < 0) { |
| 11073 | alc_free(codec); |
| 11074 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11075 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11076 | printk(KERN_INFO |
| 11077 | "hda_codec: Cannot set up configuration " |
| 11078 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11079 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11080 | } |
| 11081 | } |
| 11082 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11083 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11084 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11085 | if (err < 0) { |
| 11086 | alc_free(codec); |
| 11087 | return err; |
| 11088 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11089 | } |
| 11090 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11091 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11092 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11093 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11094 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11095 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11096 | /* FIXME: setup DAC5 */ |
| 11097 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11098 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11099 | |
| 11100 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11101 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11102 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11103 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11104 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11105 | spec->num_adc_nids = 0; |
| 11106 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11107 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11108 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11109 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11110 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11111 | unsigned int wcap = get_wcaps(codec, nid); |
| 11112 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11113 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11114 | if (wcap != AC_WID_AUD_IN) |
| 11115 | continue; |
| 11116 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11117 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11118 | if (err < 0) |
| 11119 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11120 | err = snd_hda_get_connections(codec, cap, items, |
| 11121 | ARRAY_SIZE(items)); |
| 11122 | if (err < 0) |
| 11123 | continue; |
| 11124 | for (j = 0; j < imux->num_items; j++) |
| 11125 | if (imux->items[j].index >= err) |
| 11126 | break; |
| 11127 | if (j < imux->num_items) |
| 11128 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11129 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11130 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11131 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11132 | spec->adc_nids = spec->private_adc_nids; |
| 11133 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11134 | } |
| 11135 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11136 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11137 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11138 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11139 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11140 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11141 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11142 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11143 | spec->vmaster_nid = 0x0c; |
| 11144 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11145 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11146 | if (board_config == ALC882_AUTO) |
| 11147 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11148 | |
| 11149 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11150 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11151 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11152 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11153 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11154 | |
| 11155 | return 0; |
| 11156 | } |
| 11157 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11158 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11159 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11160 | * ALC262 support |
| 11161 | */ |
| 11162 | |
| 11163 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11164 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11165 | |
| 11166 | #define alc262_dac_nids alc260_dac_nids |
| 11167 | #define alc262_adc_nids alc882_adc_nids |
| 11168 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11169 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11170 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11171 | |
| 11172 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11173 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11174 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11175 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11176 | /* ADC0 */ |
| 11177 | 0x09 |
| 11178 | }; |
| 11179 | |
| 11180 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11181 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11182 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11183 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11184 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11185 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11186 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11187 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11188 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11189 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11190 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11191 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11192 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11193 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11194 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11195 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11196 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11197 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11198 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11199 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11200 | }; |
| 11201 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11202 | /* update HP, line and mono-out pins according to the master switch */ |
| 11203 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 11204 | { |
| 11205 | struct alc_spec *spec = codec->spec; |
| 11206 | int val = spec->master_sw; |
| 11207 | |
| 11208 | /* HP & line-out */ |
| 11209 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 11210 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11211 | val ? PIN_HP : 0); |
| 11212 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11213 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11214 | val ? PIN_HP : 0); |
| 11215 | /* mono (speaker) depending on the HP jack sense */ |
| 11216 | val = val && !spec->jack_present; |
| 11217 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11218 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11219 | val ? PIN_OUT : 0); |
| 11220 | } |
| 11221 | |
| 11222 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11223 | { |
| 11224 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11225 | |
| 11226 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11227 | alc262_hp_master_update(codec); |
| 11228 | } |
| 11229 | |
| 11230 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11231 | { |
| 11232 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11233 | return; |
| 11234 | alc262_hp_bpc_automute(codec); |
| 11235 | } |
| 11236 | |
| 11237 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11238 | { |
| 11239 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11240 | |
| 11241 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11242 | alc262_hp_master_update(codec); |
| 11243 | } |
| 11244 | |
| 11245 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11246 | unsigned int res) |
| 11247 | { |
| 11248 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11249 | return; |
| 11250 | alc262_hp_wildwest_automute(codec); |
| 11251 | } |
| 11252 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11253 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11254 | |
| 11255 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11256 | struct snd_ctl_elem_value *ucontrol) |
| 11257 | { |
| 11258 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11259 | struct alc_spec *spec = codec->spec; |
| 11260 | int val = !!*ucontrol->value.integer.value; |
| 11261 | |
| 11262 | if (val == spec->master_sw) |
| 11263 | return 0; |
| 11264 | spec->master_sw = val; |
| 11265 | alc262_hp_master_update(codec); |
| 11266 | return 1; |
| 11267 | } |
| 11268 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11269 | #define ALC262_HP_MASTER_SWITCH \ |
| 11270 | { \ |
| 11271 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11272 | .name = "Master Playback Switch", \ |
| 11273 | .info = snd_ctl_boolean_mono_info, \ |
| 11274 | .get = alc262_hp_master_sw_get, \ |
| 11275 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11276 | }, \ |
| 11277 | { \ |
| 11278 | .iface = NID_MAPPING, \ |
| 11279 | .name = "Master Playback Switch", \ |
| 11280 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11281 | } |
| 11282 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11283 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11284 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11285 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11286 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11287 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11288 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11289 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11290 | HDA_OUTPUT), |
| 11291 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11292 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11293 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11294 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11295 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11296 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11297 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11298 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11299 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11300 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11301 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11302 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11303 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11304 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11305 | { } /* end */ |
| 11306 | }; |
| 11307 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11308 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11309 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11310 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11311 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11312 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11313 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11314 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11315 | HDA_OUTPUT), |
| 11316 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11317 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11318 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11319 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11320 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11321 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11322 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11323 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11324 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11325 | { } /* end */ |
| 11326 | }; |
| 11327 | |
| 11328 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11329 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11330 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11331 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11332 | { } /* end */ |
| 11333 | }; |
| 11334 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11335 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11336 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11337 | { |
| 11338 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11339 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11340 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11341 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11342 | } |
| 11343 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11344 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11345 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11346 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11347 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11348 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11349 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11350 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11351 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11352 | { } /* end */ |
| 11353 | }; |
| 11354 | |
| 11355 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11356 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11357 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11358 | |
| 11359 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11360 | { } |
| 11361 | }; |
| 11362 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11363 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11364 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11365 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11366 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11367 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11368 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11369 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11370 | { } /* end */ |
| 11371 | }; |
| 11372 | |
| 11373 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11374 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11375 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11376 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11377 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11378 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11379 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11380 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11381 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11382 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11383 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11384 | {} |
| 11385 | }; |
| 11386 | |
| 11387 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11388 | .num_items = 1, |
| 11389 | .items = { |
| 11390 | { "Line", 0x1 }, |
| 11391 | }, |
| 11392 | }; |
| 11393 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11394 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11395 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11396 | { |
| 11397 | struct alc_spec *spec = codec->spec; |
| 11398 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11399 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11400 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11401 | unsigned int mute; |
| 11402 | |
| 11403 | /* HP */ |
| 11404 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11405 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11406 | HDA_AMP_MUTE, mute); |
| 11407 | /* mute internal speaker per jack sense */ |
| 11408 | if (spec->jack_present) |
| 11409 | mute = HDA_AMP_MUTE; |
| 11410 | if (line_nid) |
| 11411 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11412 | HDA_AMP_MUTE, mute); |
| 11413 | if (speaker_nid && speaker_nid != line_nid) |
| 11414 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11415 | HDA_AMP_MUTE, mute); |
| 11416 | } |
| 11417 | |
| 11418 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11419 | |
| 11420 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11421 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11422 | { |
| 11423 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11424 | struct alc_spec *spec = codec->spec; |
| 11425 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11426 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11427 | if (val == spec->master_sw) |
| 11428 | return 0; |
| 11429 | spec->master_sw = val; |
| 11430 | alc262_hippo_master_update(codec); |
| 11431 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11432 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11433 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11434 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11435 | { \ |
| 11436 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11437 | .name = "Master Playback Switch", \ |
| 11438 | .info = snd_ctl_boolean_mono_info, \ |
| 11439 | .get = alc262_hippo_master_sw_get, \ |
| 11440 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11441 | }, \ |
| 11442 | { \ |
| 11443 | .iface = NID_MAPPING, \ |
| 11444 | .name = "Master Playback Switch", \ |
| 11445 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11446 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11447 | } |
| 11448 | |
| 11449 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11450 | ALC262_HIPPO_MASTER_SWITCH, |
| 11451 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11455 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11457 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11458 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11459 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11460 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11461 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11462 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11463 | { } /* end */ |
| 11464 | }; |
| 11465 | |
| 11466 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11467 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11468 | ALC262_HIPPO_MASTER_SWITCH, |
| 11469 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11470 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11471 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11472 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11473 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11474 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11475 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11476 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11477 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11478 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11479 | { } /* end */ |
| 11480 | }; |
| 11481 | |
| 11482 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11483 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11484 | { |
| 11485 | struct alc_spec *spec = codec->spec; |
| 11486 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11487 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11488 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11489 | alc262_hippo_master_update(codec); |
| 11490 | } |
| 11491 | |
| 11492 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11493 | { |
| 11494 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11495 | return; |
| 11496 | alc262_hippo_automute(codec); |
| 11497 | } |
| 11498 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11499 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11500 | { |
| 11501 | struct alc_spec *spec = codec->spec; |
| 11502 | |
| 11503 | spec->autocfg.hp_pins[0] = 0x15; |
| 11504 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11505 | } |
| 11506 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11507 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11508 | { |
| 11509 | struct alc_spec *spec = codec->spec; |
| 11510 | |
| 11511 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11512 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11513 | } |
| 11514 | |
| 11515 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11516 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11517 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11518 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11519 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11520 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11521 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11522 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11523 | { } /* end */ |
| 11524 | }; |
| 11525 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11526 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11527 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11528 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11529 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11530 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11531 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11532 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11533 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11534 | { } /* end */ |
| 11535 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11536 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11537 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11538 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11539 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11540 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11541 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11542 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11543 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11544 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11545 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11546 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11547 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11548 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11549 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11550 | { } /* end */ |
| 11551 | }; |
| 11552 | |
| 11553 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11554 | /* Headphone automute */ |
| 11555 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11556 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11557 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11558 | |
| 11559 | /* P11 AUX_IN, white 4-pin connector */ |
| 11560 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11561 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11562 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11563 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11564 | |
| 11565 | {} |
| 11566 | }; |
| 11567 | |
| 11568 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11569 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11570 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11571 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11572 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11573 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11574 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11575 | } |
| 11576 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11577 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11578 | #define alc262_capture_mixer alc882_capture_mixer |
| 11579 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11580 | |
| 11581 | /* |
| 11582 | * generic initialization of ADC, input mixers and output mixers |
| 11583 | */ |
| 11584 | static struct hda_verb alc262_init_verbs[] = { |
| 11585 | /* |
| 11586 | * Unmute ADC0-2 and set the default input to mic-in |
| 11587 | */ |
| 11588 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11589 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11590 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11591 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11592 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11593 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11594 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11595 | /* 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] | 11596 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11597 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11598 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11599 | */ |
| 11600 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11601 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11602 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11603 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11604 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11605 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11606 | |
| 11607 | /* |
| 11608 | * Set up output mixers (0x0c - 0x0e) |
| 11609 | */ |
| 11610 | /* set vol=0 to output mixers */ |
| 11611 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11612 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11613 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11614 | /* set up input amps for analog loopback */ |
| 11615 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11616 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11618 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11620 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11621 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11622 | |
| 11623 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11624 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11625 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11626 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11627 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11628 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11629 | |
| 11630 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11631 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11632 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11633 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11634 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11635 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11636 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11637 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11638 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11639 | /* FIXME: use matrix-type input source selection */ |
| 11640 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11641 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11642 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11643 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11644 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11645 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11646 | /* Input mixer2 */ |
| 11647 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11648 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11649 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11650 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11651 | /* Input mixer3 */ |
| 11652 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11653 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11654 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11655 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11656 | |
| 11657 | { } |
| 11658 | }; |
| 11659 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11660 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11661 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11662 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11663 | { } |
| 11664 | }; |
| 11665 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11666 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11667 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11668 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11669 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11670 | |
| 11671 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11672 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11673 | {} |
| 11674 | }; |
| 11675 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11676 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11677 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11678 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11679 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11680 | |
| 11681 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11682 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11683 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11684 | }; |
| 11685 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11686 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11687 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11688 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11689 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11692 | { } /* end */ |
| 11693 | }; |
| 11694 | |
| 11695 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11696 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11697 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11698 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11699 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11700 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11701 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11702 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11703 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11704 | {} |
| 11705 | }; |
| 11706 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11707 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11708 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11709 | struct alc_spec *spec = codec->spec; |
| 11710 | |
| 11711 | spec->autocfg.hp_pins[0] = 0x15; |
| 11712 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11713 | spec->ext_mic.pin = 0x18; |
| 11714 | spec->ext_mic.mux_idx = 0; |
| 11715 | spec->int_mic.pin = 0x12; |
| 11716 | spec->int_mic.mux_idx = 9; |
| 11717 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11718 | } |
| 11719 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11720 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11721 | * nec model |
| 11722 | * 0x15 = headphone |
| 11723 | * 0x16 = internal speaker |
| 11724 | * 0x18 = external mic |
| 11725 | */ |
| 11726 | |
| 11727 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11728 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11729 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11730 | |
| 11731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11732 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11733 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11734 | |
| 11735 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11736 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11737 | { } /* end */ |
| 11738 | }; |
| 11739 | |
| 11740 | static struct hda_verb alc262_nec_verbs[] = { |
| 11741 | /* Unmute Speaker */ |
| 11742 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11743 | |
| 11744 | /* Headphone */ |
| 11745 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11746 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11747 | |
| 11748 | /* External mic to headphone */ |
| 11749 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11750 | /* External mic to speaker */ |
| 11751 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11752 | {} |
| 11753 | }; |
| 11754 | |
| 11755 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11756 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11757 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11758 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11759 | */ |
| 11760 | |
| 11761 | #define ALC_HP_EVENT 0x37 |
| 11762 | |
| 11763 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11764 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11765 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11766 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11767 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11768 | {} |
| 11769 | }; |
| 11770 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11771 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11772 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11773 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11774 | {} |
| 11775 | }; |
| 11776 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11777 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11778 | /* Front Mic pin: input vref at 50% */ |
| 11779 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11780 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11781 | {} |
| 11782 | }; |
| 11783 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11784 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11785 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11786 | .items = { |
| 11787 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11788 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11789 | { "CD", 0x4 }, |
| 11790 | }, |
| 11791 | }; |
| 11792 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11793 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11794 | .num_items = 5, |
| 11795 | .items = { |
| 11796 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11797 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11798 | { "Line", 0x2 }, |
| 11799 | { "CD", 0x4 }, |
| 11800 | { "AUX IN", 0x6 }, |
| 11801 | }, |
| 11802 | }; |
| 11803 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11804 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11805 | .num_items = 4, |
| 11806 | .items = { |
| 11807 | { "Mic", 0x0 }, |
| 11808 | { "Front Mic", 0x2 }, |
| 11809 | { "Line", 0x1 }, |
| 11810 | { "CD", 0x4 }, |
| 11811 | }, |
| 11812 | }; |
| 11813 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11814 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11815 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11816 | { |
| 11817 | struct alc_spec *spec = codec->spec; |
| 11818 | unsigned int mute; |
| 11819 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11820 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11821 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11822 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11823 | spec->sense_updated = 1; |
| 11824 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11825 | /* unmute internal speaker only if both HPs are unplugged and |
| 11826 | * master switch is on |
| 11827 | */ |
| 11828 | if (spec->jack_present) |
| 11829 | mute = HDA_AMP_MUTE; |
| 11830 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11831 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11832 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11833 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11834 | } |
| 11835 | |
| 11836 | /* unsolicited event for HP jack sensing */ |
| 11837 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11838 | unsigned int res) |
| 11839 | { |
| 11840 | if ((res >> 26) != ALC_HP_EVENT) |
| 11841 | return; |
| 11842 | alc262_fujitsu_automute(codec, 1); |
| 11843 | } |
| 11844 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11845 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11846 | { |
| 11847 | alc262_fujitsu_automute(codec, 1); |
| 11848 | } |
| 11849 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11850 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11851 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11852 | .ops = &snd_hda_bind_vol, |
| 11853 | .values = { |
| 11854 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11855 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11856 | 0 |
| 11857 | }, |
| 11858 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11859 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11860 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11861 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11862 | { |
| 11863 | struct alc_spec *spec = codec->spec; |
| 11864 | unsigned int mute; |
| 11865 | |
| 11866 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11867 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11868 | spec->sense_updated = 1; |
| 11869 | } |
| 11870 | if (spec->jack_present) { |
| 11871 | /* mute internal speaker */ |
| 11872 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11873 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11874 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11875 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11876 | } else { |
| 11877 | /* unmute internal speaker if necessary */ |
| 11878 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11879 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11880 | HDA_AMP_MUTE, mute); |
| 11881 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11882 | HDA_AMP_MUTE, mute); |
| 11883 | } |
| 11884 | } |
| 11885 | |
| 11886 | /* unsolicited event for HP jack sensing */ |
| 11887 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11888 | unsigned int res) |
| 11889 | { |
| 11890 | if ((res >> 26) != ALC_HP_EVENT) |
| 11891 | return; |
| 11892 | alc262_lenovo_3000_automute(codec, 1); |
| 11893 | } |
| 11894 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11895 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11896 | int dir, int idx, long *valp) |
| 11897 | { |
| 11898 | int i, change = 0; |
| 11899 | |
| 11900 | for (i = 0; i < 2; i++, valp++) |
| 11901 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11902 | HDA_AMP_MUTE, |
| 11903 | *valp ? 0 : HDA_AMP_MUTE); |
| 11904 | return change; |
| 11905 | } |
| 11906 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11907 | /* bind hp and internal speaker mute (with plug check) */ |
| 11908 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11909 | struct snd_ctl_elem_value *ucontrol) |
| 11910 | { |
| 11911 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11912 | long *valp = ucontrol->value.integer.value; |
| 11913 | int change; |
| 11914 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11915 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11916 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11917 | if (change) |
| 11918 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11919 | return change; |
| 11920 | } |
| 11921 | |
| 11922 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11923 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11924 | { |
| 11925 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11926 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11927 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11928 | .info = snd_hda_mixer_amp_switch_info, |
| 11929 | .get = snd_hda_mixer_amp_switch_get, |
| 11930 | .put = alc262_fujitsu_master_sw_put, |
| 11931 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11932 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11933 | { |
| 11934 | .iface = NID_MAPPING, |
| 11935 | .name = "Master Playback Switch", |
| 11936 | .private_value = 0x1b, |
| 11937 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11938 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11939 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11940 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11942 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11943 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11944 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11945 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11946 | { } /* end */ |
| 11947 | }; |
| 11948 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11949 | /* bind hp and internal speaker mute (with plug check) */ |
| 11950 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11951 | struct snd_ctl_elem_value *ucontrol) |
| 11952 | { |
| 11953 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11954 | long *valp = ucontrol->value.integer.value; |
| 11955 | int change; |
| 11956 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11957 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11958 | if (change) |
| 11959 | alc262_lenovo_3000_automute(codec, 0); |
| 11960 | return change; |
| 11961 | } |
| 11962 | |
| 11963 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11964 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11965 | { |
| 11966 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11967 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11968 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11969 | .info = snd_hda_mixer_amp_switch_info, |
| 11970 | .get = snd_hda_mixer_amp_switch_get, |
| 11971 | .put = alc262_lenovo_3000_master_sw_put, |
| 11972 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11973 | }, |
| 11974 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11975 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11976 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11977 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11978 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11979 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11980 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11981 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11982 | { } /* end */ |
| 11983 | }; |
| 11984 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11985 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11986 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11987 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11988 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11989 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11990 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11991 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11992 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11993 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11994 | { } /* end */ |
| 11995 | }; |
| 11996 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11997 | /* additional init verbs for Benq laptops */ |
| 11998 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11999 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 12000 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 12001 | {} |
| 12002 | }; |
| 12003 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12004 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 12005 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12006 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12007 | |
| 12008 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 12009 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 12010 | {} |
| 12011 | }; |
| 12012 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12013 | /* Samsung Q1 Ultra Vista model setup */ |
| 12014 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12015 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 12016 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12017 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12018 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12019 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 12020 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12021 | { } /* end */ |
| 12022 | }; |
| 12023 | |
| 12024 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12025 | /* output mixer */ |
| 12026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12027 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12028 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12029 | /* speaker */ |
| 12030 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12031 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12032 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12033 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12034 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12035 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12036 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12038 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12039 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12040 | /* internal mic */ |
| 12041 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12043 | /* ADC, choose mic */ |
| 12044 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12045 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12046 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 12053 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12054 | {} |
| 12055 | }; |
| 12056 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12057 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12058 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 12059 | { |
| 12060 | struct alc_spec *spec = codec->spec; |
| 12061 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12062 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12063 | mute = 0; |
| 12064 | /* auto-mute only when HP is used as HP */ |
| 12065 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12066 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12067 | if (spec->jack_present) |
| 12068 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12069 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12070 | /* mute/unmute internal speaker */ |
| 12071 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12072 | HDA_AMP_MUTE, mute); |
| 12073 | /* mute/unmute HP */ |
| 12074 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12075 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12076 | } |
| 12077 | |
| 12078 | /* unsolicited event for HP jack sensing */ |
| 12079 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 12080 | unsigned int res) |
| 12081 | { |
| 12082 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12083 | return; |
| 12084 | alc262_ultra_automute(codec); |
| 12085 | } |
| 12086 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12087 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 12088 | .num_items = 2, |
| 12089 | .items = { |
| 12090 | { "Mic", 0x1 }, |
| 12091 | { "Headphone", 0x7 }, |
| 12092 | }, |
| 12093 | }; |
| 12094 | |
| 12095 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12096 | struct snd_ctl_elem_value *ucontrol) |
| 12097 | { |
| 12098 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12099 | struct alc_spec *spec = codec->spec; |
| 12100 | int ret; |
| 12101 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12102 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12103 | if (!ret) |
| 12104 | return 0; |
| 12105 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12106 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12107 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12108 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12109 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12110 | return ret; |
| 12111 | } |
| 12112 | |
| 12113 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12114 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12115 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12116 | { |
| 12117 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12118 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12119 | .info = alc_mux_enum_info, |
| 12120 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12121 | .put = alc262_ultra_mux_enum_put, |
| 12122 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12123 | { |
| 12124 | .iface = NID_MAPPING, |
| 12125 | .name = "Capture Source", |
| 12126 | .private_value = 0x15, |
| 12127 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12128 | { } /* end */ |
| 12129 | }; |
| 12130 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12131 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12132 | * and thus it's bound with a different mixer. |
| 12133 | * This function returns which mixer amp should be used. |
| 12134 | */ |
| 12135 | static int alc262_check_volbit(hda_nid_t nid) |
| 12136 | { |
| 12137 | if (!nid) |
| 12138 | return 0; |
| 12139 | else if (nid == 0x16) |
| 12140 | return 2; |
| 12141 | else |
| 12142 | return 1; |
| 12143 | } |
| 12144 | |
| 12145 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12146 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12147 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12148 | unsigned long val; |
| 12149 | int vbit; |
| 12150 | |
| 12151 | vbit = alc262_check_volbit(nid); |
| 12152 | if (!vbit) |
| 12153 | return 0; |
| 12154 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12155 | return 0; |
| 12156 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12157 | if (vbit == 2) |
| 12158 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12159 | else |
| 12160 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12161 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12162 | } |
| 12163 | |
| 12164 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12165 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12166 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12167 | unsigned long val; |
| 12168 | |
| 12169 | if (!nid) |
| 12170 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12171 | if (nid == 0x16) |
| 12172 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12173 | else |
| 12174 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12175 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12176 | } |
| 12177 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12178 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12179 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12180 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12181 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12182 | const char *pfx; |
| 12183 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12184 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12185 | |
| 12186 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12187 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12188 | spec->multiout.dac_nids[0] = 2; |
| 12189 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12190 | pfx = alc_get_line_out_pfx(cfg, true); |
| 12191 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12192 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12193 | for (i = 0; i < 2; i++) { |
| 12194 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12195 | if (err < 0) |
| 12196 | return err; |
| 12197 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12198 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12199 | "Speaker", i); |
| 12200 | if (err < 0) |
| 12201 | return err; |
| 12202 | } |
| 12203 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12204 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12205 | "Headphone", i); |
| 12206 | if (err < 0) |
| 12207 | return err; |
| 12208 | } |
| 12209 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12210 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12211 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12212 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12213 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12214 | if (vbits == 1 || vbits == 2) |
| 12215 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12216 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12217 | for (i = 0; i < 2; i++) { |
| 12218 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12219 | &vbits, i); |
| 12220 | if (err < 0) |
| 12221 | return err; |
| 12222 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12223 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12224 | "Speaker", &vbits, i); |
| 12225 | if (err < 0) |
| 12226 | return err; |
| 12227 | } |
| 12228 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12229 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12230 | "Headphone", &vbits, i); |
| 12231 | if (err < 0) |
| 12232 | return err; |
| 12233 | } |
| 12234 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12235 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12236 | } |
| 12237 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12238 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12239 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12240 | |
| 12241 | /* |
| 12242 | * generic initialization of ADC, input mixers and output mixers |
| 12243 | */ |
| 12244 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12245 | /* |
| 12246 | * Unmute ADC0-2 and set the default input to mic-in |
| 12247 | */ |
| 12248 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12249 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12250 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12251 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12252 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12253 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12254 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12255 | /* 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] | 12256 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12257 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12258 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12259 | */ |
| 12260 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12261 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12262 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12263 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12264 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12266 | |
| 12267 | /* |
| 12268 | * Set up output mixers (0x0c - 0x0f) |
| 12269 | */ |
| 12270 | /* set vol=0 to output mixers */ |
| 12271 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12272 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12273 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12274 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12275 | /* set up input amps for analog loopback */ |
| 12276 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12277 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12278 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12279 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12280 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12281 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12282 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12283 | |
| 12284 | /* FIXME: use matrix-type input source selection */ |
| 12285 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12286 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12287 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12288 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12289 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12290 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12291 | /* Input mixer2 */ |
| 12292 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12293 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12294 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12295 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12296 | /* Input mixer3 */ |
| 12297 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12298 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12299 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12300 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12301 | |
| 12302 | { } |
| 12303 | }; |
| 12304 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12305 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12306 | /* |
| 12307 | * Unmute ADC0-2 and set the default input to mic-in |
| 12308 | */ |
| 12309 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12310 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12311 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12312 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12313 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12314 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12315 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12316 | /* 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] | 12317 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12318 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12319 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12320 | */ |
| 12321 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12322 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12323 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12324 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12329 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12330 | /* |
| 12331 | * Set up output mixers (0x0c - 0x0e) |
| 12332 | */ |
| 12333 | /* set vol=0 to output mixers */ |
| 12334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12335 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12336 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12337 | |
| 12338 | /* set up input amps for analog loopback */ |
| 12339 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12340 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12341 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12342 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12343 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12344 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12345 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12346 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12347 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12348 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12349 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12350 | |
| 12351 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12352 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12353 | |
| 12354 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12355 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12356 | |
| 12357 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12358 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12359 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12360 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12361 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12362 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12363 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12364 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12365 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12366 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12367 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12368 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12369 | |
| 12370 | |
| 12371 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12372 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12373 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12374 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12375 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12376 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12377 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12378 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12379 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12380 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12381 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12382 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12383 | /* Input mixer2 */ |
| 12384 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12385 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12386 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12387 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12388 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12389 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12390 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12391 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12393 | /* Input mixer3 */ |
| 12394 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12395 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12401 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12402 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12403 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12404 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12405 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12406 | { } |
| 12407 | }; |
| 12408 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12409 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12410 | /* |
| 12411 | * Unmute ADC0-2 and set the default input to mic-in |
| 12412 | */ |
| 12413 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12414 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12415 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12416 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12417 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12418 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12419 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12420 | /* 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] | 12421 | * mixer widget |
| 12422 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12423 | * panel mic (mic 2) |
| 12424 | */ |
| 12425 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12426 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12427 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12428 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12429 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12430 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12431 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12432 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12433 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12434 | /* |
| 12435 | * Set up output mixers (0x0c - 0x0e) |
| 12436 | */ |
| 12437 | /* set vol=0 to output mixers */ |
| 12438 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12439 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12440 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12441 | |
| 12442 | /* set up input amps for analog loopback */ |
| 12443 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12444 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12445 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12446 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12447 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12448 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12449 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12450 | |
| 12451 | |
| 12452 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12453 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12454 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12455 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12456 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12457 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12458 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12459 | |
| 12460 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12461 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12462 | |
| 12463 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12464 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12465 | |
| 12466 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12467 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12468 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12469 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12470 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12471 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12472 | |
| 12473 | /* FIXME: use matrix-type input source selection */ |
| 12474 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12475 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12476 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12477 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12478 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12479 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12480 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12481 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12482 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12483 | /* Input mixer2 */ |
| 12484 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12485 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12486 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12487 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12488 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12489 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12490 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12491 | /* Input mixer3 */ |
| 12492 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12497 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12498 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12499 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12500 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12501 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12502 | { } |
| 12503 | }; |
| 12504 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12505 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12506 | |
| 12507 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12509 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12510 | |
| 12511 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12512 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12513 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12514 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12515 | |
| 12516 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12517 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12518 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12519 | {} |
| 12520 | }; |
| 12521 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12522 | /* |
| 12523 | * Pin config fixes |
| 12524 | */ |
| 12525 | enum { |
| 12526 | PINFIX_FSC_H270, |
| 12527 | }; |
| 12528 | |
| 12529 | static const struct alc_fixup alc262_fixups[] = { |
| 12530 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12531 | .type = ALC_FIXUP_PINS, |
| 12532 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12533 | { 0x14, 0x99130110 }, /* speaker */ |
| 12534 | { 0x15, 0x0221142f }, /* front HP */ |
| 12535 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12536 | { } |
| 12537 | } |
| 12538 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12539 | }; |
| 12540 | |
| 12541 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12542 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12543 | {} |
| 12544 | }; |
| 12545 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12546 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12547 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12548 | #define alc262_loopbacks alc880_loopbacks |
| 12549 | #endif |
| 12550 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12551 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12552 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12553 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12554 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12555 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12556 | |
| 12557 | /* |
| 12558 | * BIOS auto configuration |
| 12559 | */ |
| 12560 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12561 | { |
| 12562 | struct alc_spec *spec = codec->spec; |
| 12563 | int err; |
| 12564 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12565 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12566 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12567 | alc262_ignore); |
| 12568 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12569 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12570 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12571 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12572 | spec->multiout.max_channels = 2; |
| 12573 | spec->no_analog = 1; |
| 12574 | goto dig_only; |
| 12575 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12576 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12577 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12578 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12579 | if (err < 0) |
| 12580 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12581 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12582 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12583 | return err; |
| 12584 | |
| 12585 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12586 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12587 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12588 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12589 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12590 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12591 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12592 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12593 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12594 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12595 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12596 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12597 | err = alc_auto_add_mic_boost(codec); |
| 12598 | if (err < 0) |
| 12599 | return err; |
| 12600 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12601 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12602 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12603 | return 1; |
| 12604 | } |
| 12605 | |
| 12606 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12607 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12608 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12609 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12610 | |
| 12611 | |
| 12612 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12613 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12614 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12615 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12616 | alc262_auto_init_multi_out(codec); |
| 12617 | alc262_auto_init_hp_out(codec); |
| 12618 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12619 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12620 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12621 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12622 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12623 | } |
| 12624 | |
| 12625 | /* |
| 12626 | * configuration and preset |
| 12627 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12628 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12629 | [ALC262_BASIC] = "basic", |
| 12630 | [ALC262_HIPPO] = "hippo", |
| 12631 | [ALC262_HIPPO_1] = "hippo_1", |
| 12632 | [ALC262_FUJITSU] = "fujitsu", |
| 12633 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12634 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12635 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12636 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12637 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12638 | [ALC262_BENQ_T31] = "benq-t31", |
| 12639 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12640 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12641 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12642 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12643 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12644 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12645 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12646 | [ALC262_AUTO] = "auto", |
| 12647 | }; |
| 12648 | |
| 12649 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12650 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12651 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12652 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12653 | ALC262_HP_BPC), |
| 12654 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12655 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12656 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12657 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12658 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12659 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12660 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12661 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12662 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12663 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12664 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12665 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12666 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12667 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12668 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12669 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12670 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12671 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12672 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12673 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12674 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12675 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12676 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12677 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12678 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12679 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12680 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12681 | #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] | 12682 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12683 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12684 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12685 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12686 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12687 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12688 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12689 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12690 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12691 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12692 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12693 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12694 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12695 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12696 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12697 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12698 | {} |
| 12699 | }; |
| 12700 | |
| 12701 | static struct alc_config_preset alc262_presets[] = { |
| 12702 | [ALC262_BASIC] = { |
| 12703 | .mixers = { alc262_base_mixer }, |
| 12704 | .init_verbs = { alc262_init_verbs }, |
| 12705 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12706 | .dac_nids = alc262_dac_nids, |
| 12707 | .hp_nid = 0x03, |
| 12708 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12709 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12710 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12711 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12712 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12713 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12714 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12715 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12716 | .dac_nids = alc262_dac_nids, |
| 12717 | .hp_nid = 0x03, |
| 12718 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12719 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12720 | .channel_mode = alc262_modes, |
| 12721 | .input_mux = &alc262_capture_source, |
| 12722 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12723 | .setup = alc262_hippo_setup, |
| 12724 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12725 | }, |
| 12726 | [ALC262_HIPPO_1] = { |
| 12727 | .mixers = { alc262_hippo1_mixer }, |
| 12728 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12729 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12730 | .dac_nids = alc262_dac_nids, |
| 12731 | .hp_nid = 0x02, |
| 12732 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12733 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12734 | .channel_mode = alc262_modes, |
| 12735 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12736 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12737 | .setup = alc262_hippo1_setup, |
| 12738 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12739 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12740 | [ALC262_FUJITSU] = { |
| 12741 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12742 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12743 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12744 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12745 | .dac_nids = alc262_dac_nids, |
| 12746 | .hp_nid = 0x03, |
| 12747 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12748 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12749 | .channel_mode = alc262_modes, |
| 12750 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12751 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12752 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12753 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12754 | [ALC262_HP_BPC] = { |
| 12755 | .mixers = { alc262_HP_BPC_mixer }, |
| 12756 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12757 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12758 | .dac_nids = alc262_dac_nids, |
| 12759 | .hp_nid = 0x03, |
| 12760 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12761 | .channel_mode = alc262_modes, |
| 12762 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12763 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12764 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12765 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12766 | [ALC262_HP_BPC_D7000_WF] = { |
| 12767 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12768 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12769 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12770 | .dac_nids = alc262_dac_nids, |
| 12771 | .hp_nid = 0x03, |
| 12772 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12773 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12774 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12775 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12776 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12777 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12778 | [ALC262_HP_BPC_D7000_WL] = { |
| 12779 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12780 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12781 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12782 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12783 | .dac_nids = alc262_dac_nids, |
| 12784 | .hp_nid = 0x03, |
| 12785 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12786 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12787 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12788 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12789 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12790 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12791 | [ALC262_HP_TC_T5735] = { |
| 12792 | .mixers = { alc262_hp_t5735_mixer }, |
| 12793 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12794 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12795 | .dac_nids = alc262_dac_nids, |
| 12796 | .hp_nid = 0x03, |
| 12797 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12798 | .channel_mode = alc262_modes, |
| 12799 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12800 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12801 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12802 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12803 | }, |
| 12804 | [ALC262_HP_RP5700] = { |
| 12805 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12806 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12807 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12808 | .dac_nids = alc262_dac_nids, |
| 12809 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12810 | .channel_mode = alc262_modes, |
| 12811 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12812 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12813 | [ALC262_BENQ_ED8] = { |
| 12814 | .mixers = { alc262_base_mixer }, |
| 12815 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12816 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12817 | .dac_nids = alc262_dac_nids, |
| 12818 | .hp_nid = 0x03, |
| 12819 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12820 | .channel_mode = alc262_modes, |
| 12821 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12822 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12823 | [ALC262_SONY_ASSAMD] = { |
| 12824 | .mixers = { alc262_sony_mixer }, |
| 12825 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12826 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12827 | .dac_nids = alc262_dac_nids, |
| 12828 | .hp_nid = 0x02, |
| 12829 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12830 | .channel_mode = alc262_modes, |
| 12831 | .input_mux = &alc262_capture_source, |
| 12832 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12833 | .setup = alc262_hippo_setup, |
| 12834 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12835 | }, |
| 12836 | [ALC262_BENQ_T31] = { |
| 12837 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12838 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12839 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12840 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12841 | .dac_nids = alc262_dac_nids, |
| 12842 | .hp_nid = 0x03, |
| 12843 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12844 | .channel_mode = alc262_modes, |
| 12845 | .input_mux = &alc262_capture_source, |
| 12846 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12847 | .setup = alc262_hippo_setup, |
| 12848 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12849 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12850 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12851 | .mixers = { alc262_ultra_mixer }, |
| 12852 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12853 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12854 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12855 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12856 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12857 | .channel_mode = alc262_modes, |
| 12858 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12859 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12860 | .capsrc_nids = alc262_capsrc_nids, |
| 12861 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12862 | .unsol_event = alc262_ultra_unsol_event, |
| 12863 | .init_hook = alc262_ultra_automute, |
| 12864 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12865 | [ALC262_LENOVO_3000] = { |
| 12866 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12867 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12868 | alc262_lenovo_3000_unsol_verbs, |
| 12869 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12870 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12871 | .dac_nids = alc262_dac_nids, |
| 12872 | .hp_nid = 0x03, |
| 12873 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12874 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12875 | .channel_mode = alc262_modes, |
| 12876 | .input_mux = &alc262_fujitsu_capture_source, |
| 12877 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12878 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12879 | [ALC262_NEC] = { |
| 12880 | .mixers = { alc262_nec_mixer }, |
| 12881 | .init_verbs = { alc262_nec_verbs }, |
| 12882 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12883 | .dac_nids = alc262_dac_nids, |
| 12884 | .hp_nid = 0x03, |
| 12885 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12886 | .channel_mode = alc262_modes, |
| 12887 | .input_mux = &alc262_capture_source, |
| 12888 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12889 | [ALC262_TOSHIBA_S06] = { |
| 12890 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12891 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12892 | alc262_eapd_verbs }, |
| 12893 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12894 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12895 | .dac_nids = alc262_dac_nids, |
| 12896 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12897 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12898 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12899 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12900 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12901 | .unsol_event = alc_sku_unsol_event, |
| 12902 | .setup = alc262_toshiba_s06_setup, |
| 12903 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12904 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12905 | [ALC262_TOSHIBA_RX1] = { |
| 12906 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12907 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12908 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12909 | .dac_nids = alc262_dac_nids, |
| 12910 | .hp_nid = 0x03, |
| 12911 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12912 | .channel_mode = alc262_modes, |
| 12913 | .input_mux = &alc262_capture_source, |
| 12914 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12915 | .setup = alc262_hippo_setup, |
| 12916 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12917 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12918 | [ALC262_TYAN] = { |
| 12919 | .mixers = { alc262_tyan_mixer }, |
| 12920 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12921 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12922 | .dac_nids = alc262_dac_nids, |
| 12923 | .hp_nid = 0x02, |
| 12924 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12925 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12926 | .channel_mode = alc262_modes, |
| 12927 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12928 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12929 | .setup = alc262_tyan_setup, |
| 12930 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12931 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12932 | }; |
| 12933 | |
| 12934 | static int patch_alc262(struct hda_codec *codec) |
| 12935 | { |
| 12936 | struct alc_spec *spec; |
| 12937 | int board_config; |
| 12938 | int err; |
| 12939 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12940 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12941 | if (spec == NULL) |
| 12942 | return -ENOMEM; |
| 12943 | |
| 12944 | codec->spec = spec; |
| 12945 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12946 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12947 | * under-run |
| 12948 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12949 | { |
| 12950 | int tmp; |
| 12951 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12952 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12953 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12954 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12955 | } |
| 12956 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12957 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12958 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12959 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12960 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12961 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12962 | alc262_models, |
| 12963 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12964 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12965 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12966 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12967 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12968 | board_config = ALC262_AUTO; |
| 12969 | } |
| 12970 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12971 | if (board_config == ALC262_AUTO) { |
| 12972 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12973 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12974 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12975 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12976 | if (board_config == ALC262_AUTO) { |
| 12977 | /* automatic parse from the BIOS config */ |
| 12978 | err = alc262_parse_auto_config(codec); |
| 12979 | if (err < 0) { |
| 12980 | alc_free(codec); |
| 12981 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12982 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12983 | printk(KERN_INFO |
| 12984 | "hda_codec: Cannot set up configuration " |
| 12985 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12986 | board_config = ALC262_BASIC; |
| 12987 | } |
| 12988 | } |
| 12989 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12990 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12991 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12992 | if (err < 0) { |
| 12993 | alc_free(codec); |
| 12994 | return err; |
| 12995 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12996 | } |
| 12997 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12998 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12999 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13000 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13001 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 13002 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13003 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13004 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 13005 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 13006 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13007 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13008 | int i; |
| 13009 | /* check whether the digital-mic has to be supported */ |
| 13010 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 13011 | if (spec->input_mux->items[i].index >= 9) |
| 13012 | break; |
| 13013 | } |
| 13014 | if (i < spec->input_mux->num_items) { |
| 13015 | /* use only ADC0 */ |
| 13016 | spec->adc_nids = alc262_dmic_adc_nids; |
| 13017 | spec->num_adc_nids = 1; |
| 13018 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13019 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13020 | /* all analog inputs */ |
| 13021 | /* check whether NID 0x07 is valid */ |
| 13022 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 13023 | |
| 13024 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13025 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13026 | if (wcap != AC_WID_AUD_IN) { |
| 13027 | spec->adc_nids = alc262_adc_nids_alt; |
| 13028 | spec->num_adc_nids = |
| 13029 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 13030 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 13031 | } else { |
| 13032 | spec->adc_nids = alc262_adc_nids; |
| 13033 | spec->num_adc_nids = |
| 13034 | ARRAY_SIZE(alc262_adc_nids); |
| 13035 | spec->capsrc_nids = alc262_capsrc_nids; |
| 13036 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13037 | } |
| 13038 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 13039 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13040 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13041 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13042 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13043 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 13044 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 13045 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13046 | spec->vmaster_nid = 0x0c; |
| 13047 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13048 | codec->patch_ops = alc_patch_ops; |
| 13049 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13050 | spec->init_hook = alc262_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13051 | |
| 13052 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13053 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13054 | if (!spec->loopback.amplist) |
| 13055 | spec->loopback.amplist = alc262_loopbacks; |
| 13056 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13057 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13058 | return 0; |
| 13059 | } |
| 13060 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13061 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13062 | * ALC268 channel source setting (2 channel) |
| 13063 | */ |
| 13064 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 13065 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13066 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13067 | static hda_nid_t alc268_dac_nids[2] = { |
| 13068 | /* front, hp */ |
| 13069 | 0x02, 0x03 |
| 13070 | }; |
| 13071 | |
| 13072 | static hda_nid_t alc268_adc_nids[2] = { |
| 13073 | /* ADC0-1 */ |
| 13074 | 0x08, 0x07 |
| 13075 | }; |
| 13076 | |
| 13077 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 13078 | /* ADC0 */ |
| 13079 | 0x08 |
| 13080 | }; |
| 13081 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13082 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 13083 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13084 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 13085 | /* output mixer control */ |
| 13086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13087 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13088 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13089 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13090 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13091 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13092 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13093 | { } |
| 13094 | }; |
| 13095 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13096 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 13097 | /* output mixer control */ |
| 13098 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13099 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13100 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13101 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13102 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13103 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13104 | { } |
| 13105 | }; |
| 13106 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13107 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13108 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13109 | .ops = &snd_hda_bind_sw, |
| 13110 | .values = { |
| 13111 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13112 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13113 | 0 |
| 13114 | }, |
| 13115 | }; |
| 13116 | |
| 13117 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13118 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13119 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13120 | { } |
| 13121 | }; |
| 13122 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13123 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13124 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13125 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13126 | { } |
| 13127 | }; |
| 13128 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13129 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13130 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13131 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13132 | { } /* end */ |
| 13133 | }; |
| 13134 | |
| 13135 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13136 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13137 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13138 | .ops = &snd_hda_bind_vol, |
| 13139 | .values = { |
| 13140 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13141 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13142 | 0 |
| 13143 | }, |
| 13144 | }; |
| 13145 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13146 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 13147 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 13148 | { |
| 13149 | struct alc_spec *spec = codec->spec; |
| 13150 | unsigned int mute; |
| 13151 | |
| 13152 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13153 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13154 | spec->sense_updated = 1; |
| 13155 | } |
| 13156 | if (spec->jack_present) |
| 13157 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 13158 | else /* unmute internal speaker if necessary */ |
| 13159 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13160 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13161 | HDA_AMP_MUTE, mute); |
| 13162 | } |
| 13163 | |
| 13164 | |
| 13165 | /* bind hp and internal speaker mute (with plug check) */ |
| 13166 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 13167 | struct snd_ctl_elem_value *ucontrol) |
| 13168 | { |
| 13169 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 13170 | long *valp = ucontrol->value.integer.value; |
| 13171 | int change; |
| 13172 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 13173 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13174 | if (change) |
| 13175 | alc268_acer_automute(codec, 0); |
| 13176 | return change; |
| 13177 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13178 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13179 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13180 | /* output mixer control */ |
| 13181 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13182 | { |
| 13183 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13184 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13185 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13186 | .info = snd_hda_mixer_amp_switch_info, |
| 13187 | .get = snd_hda_mixer_amp_switch_get, |
| 13188 | .put = alc268_acer_master_sw_put, |
| 13189 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13190 | }, |
| 13191 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13192 | { } |
| 13193 | }; |
| 13194 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13195 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13196 | /* output mixer control */ |
| 13197 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13198 | { |
| 13199 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13200 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13201 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13202 | .info = snd_hda_mixer_amp_switch_info, |
| 13203 | .get = snd_hda_mixer_amp_switch_get, |
| 13204 | .put = alc268_acer_master_sw_put, |
| 13205 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13206 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13207 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13208 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13209 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13210 | { } |
| 13211 | }; |
| 13212 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13213 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13214 | /* output mixer control */ |
| 13215 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13216 | { |
| 13217 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13218 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13219 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13220 | .info = snd_hda_mixer_amp_switch_info, |
| 13221 | .get = snd_hda_mixer_amp_switch_get, |
| 13222 | .put = alc268_acer_master_sw_put, |
| 13223 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13224 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13225 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13226 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13227 | { } |
| 13228 | }; |
| 13229 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13230 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13231 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13233 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13234 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13235 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13236 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13237 | { } |
| 13238 | }; |
| 13239 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13240 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13241 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13242 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13243 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13244 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13245 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13246 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13247 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13248 | { } |
| 13249 | }; |
| 13250 | |
| 13251 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13252 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13253 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13254 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13255 | |
| 13256 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13257 | unsigned int res) |
| 13258 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13259 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13260 | return; |
| 13261 | alc268_acer_automute(codec, 1); |
| 13262 | } |
| 13263 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13264 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13265 | { |
| 13266 | alc268_acer_automute(codec, 1); |
| 13267 | } |
| 13268 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13269 | /* toggle speaker-output according to the hp-jack state */ |
| 13270 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13271 | { |
| 13272 | unsigned int present; |
| 13273 | unsigned char bits; |
| 13274 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13275 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13276 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13277 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13278 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13279 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13280 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13281 | } |
| 13282 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13283 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13284 | unsigned int res) |
| 13285 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13286 | switch (res >> 26) { |
| 13287 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13288 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13289 | break; |
| 13290 | case ALC880_MIC_EVENT: |
| 13291 | alc_mic_automute(codec); |
| 13292 | break; |
| 13293 | } |
| 13294 | } |
| 13295 | |
| 13296 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13297 | { |
| 13298 | struct alc_spec *spec = codec->spec; |
| 13299 | spec->ext_mic.pin = 0x18; |
| 13300 | spec->ext_mic.mux_idx = 0; |
| 13301 | spec->int_mic.pin = 0x12; |
| 13302 | spec->int_mic.mux_idx = 6; |
| 13303 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13304 | } |
| 13305 | |
| 13306 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13307 | { |
| 13308 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13309 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13310 | } |
| 13311 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13312 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13313 | /* output mixer control */ |
| 13314 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13315 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13316 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13317 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13318 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13319 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13320 | { } |
| 13321 | }; |
| 13322 | |
| 13323 | static struct hda_verb alc268_dell_verbs[] = { |
| 13324 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13325 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13326 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13327 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13328 | { } |
| 13329 | }; |
| 13330 | |
| 13331 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13332 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13333 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13334 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13335 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13336 | spec->autocfg.hp_pins[0] = 0x15; |
| 13337 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13338 | spec->ext_mic.pin = 0x18; |
| 13339 | spec->ext_mic.mux_idx = 0; |
| 13340 | spec->int_mic.pin = 0x19; |
| 13341 | spec->int_mic.mux_idx = 1; |
| 13342 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13343 | } |
| 13344 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13345 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13346 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13347 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13348 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13349 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13350 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13351 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13352 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13353 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13354 | { } |
| 13355 | }; |
| 13356 | |
| 13357 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13358 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13359 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13360 | { } |
| 13361 | }; |
| 13362 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13363 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13364 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13365 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13366 | spec->autocfg.hp_pins[0] = 0x15; |
| 13367 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13368 | spec->ext_mic.pin = 0x18; |
| 13369 | spec->ext_mic.mux_idx = 0; |
| 13370 | spec->int_mic.pin = 0x19; |
| 13371 | spec->int_mic.mux_idx = 1; |
| 13372 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13373 | } |
| 13374 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13375 | /* |
| 13376 | * generic initialization of ADC, input mixers and output mixers |
| 13377 | */ |
| 13378 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13379 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13380 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13381 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13382 | |
| 13383 | /* |
| 13384 | * Set up output mixers (0x0c - 0x0e) |
| 13385 | */ |
| 13386 | /* set vol=0 to output mixers */ |
| 13387 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13388 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13389 | |
| 13390 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13391 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13392 | |
| 13393 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13394 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13395 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13396 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13397 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13398 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13399 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13400 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13401 | |
| 13402 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13403 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13404 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13405 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13406 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13407 | |
| 13408 | /* set PCBEEP vol = 0, mute connections */ |
| 13409 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13410 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13411 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13412 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13413 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13414 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13415 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13416 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13417 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13418 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13419 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13420 | { } |
| 13421 | }; |
| 13422 | |
| 13423 | /* |
| 13424 | * generic initialization of ADC, input mixers and output mixers |
| 13425 | */ |
| 13426 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13427 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13428 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13429 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13430 | |
| 13431 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13432 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13433 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13434 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13435 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13436 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13437 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13438 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13439 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13440 | |
| 13441 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13442 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13443 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13444 | /* set PCBEEP vol = 0, mute connections */ |
| 13445 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13446 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13447 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13448 | |
| 13449 | { } |
| 13450 | }; |
| 13451 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13452 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13453 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13454 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13455 | { } /* end */ |
| 13456 | }; |
| 13457 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13458 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13459 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13460 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13461 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13462 | { } /* end */ |
| 13463 | }; |
| 13464 | |
| 13465 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13466 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13467 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13468 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13469 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13470 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13471 | { } /* end */ |
| 13472 | }; |
| 13473 | |
| 13474 | static struct hda_input_mux alc268_capture_source = { |
| 13475 | .num_items = 4, |
| 13476 | .items = { |
| 13477 | { "Mic", 0x0 }, |
| 13478 | { "Front Mic", 0x1 }, |
| 13479 | { "Line", 0x2 }, |
| 13480 | { "CD", 0x3 }, |
| 13481 | }, |
| 13482 | }; |
| 13483 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13484 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13485 | .num_items = 3, |
| 13486 | .items = { |
| 13487 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13488 | { "Internal Mic", 0x1 }, |
| 13489 | { "Line", 0x2 }, |
| 13490 | }, |
| 13491 | }; |
| 13492 | |
| 13493 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13494 | .num_items = 3, |
| 13495 | .items = { |
| 13496 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13497 | { "Internal Mic", 0x6 }, |
| 13498 | { "Line", 0x2 }, |
| 13499 | }, |
| 13500 | }; |
| 13501 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13502 | #ifdef CONFIG_SND_DEBUG |
| 13503 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13504 | /* Volume widgets */ |
| 13505 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13506 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13507 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13508 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13509 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13510 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13511 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13512 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13513 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13514 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13515 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13516 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13517 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13518 | /* The below appears problematic on some hardwares */ |
| 13519 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13520 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13521 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13522 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13523 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13524 | |
| 13525 | /* Modes for retasking pin widgets */ |
| 13526 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13527 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13528 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13529 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13530 | |
| 13531 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13532 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13533 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13534 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13535 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13536 | |
| 13537 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13538 | * The ALC268 does not have an SPDIF input. |
| 13539 | */ |
| 13540 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13541 | |
| 13542 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13543 | * this output to turn on an external amplifier. |
| 13544 | */ |
| 13545 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13546 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13547 | |
| 13548 | { } /* end */ |
| 13549 | }; |
| 13550 | #endif |
| 13551 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13552 | /* create input playback/capture controls for the given pin */ |
| 13553 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13554 | const char *ctlname, int idx) |
| 13555 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13556 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13557 | int err; |
| 13558 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13559 | switch (nid) { |
| 13560 | case 0x14: |
| 13561 | case 0x16: |
| 13562 | dac = 0x02; |
| 13563 | break; |
| 13564 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13565 | case 0x1a: /* ALC259/269 only */ |
| 13566 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13567 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13568 | dac = 0x03; |
| 13569 | break; |
| 13570 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13571 | snd_printd(KERN_WARNING "hda_codec: " |
| 13572 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13573 | return 0; |
| 13574 | } |
| 13575 | if (spec->multiout.dac_nids[0] != dac && |
| 13576 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13577 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13578 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13579 | HDA_OUTPUT)); |
| 13580 | if (err < 0) |
| 13581 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13582 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13583 | } |
| 13584 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13585 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13586 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13587 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13588 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13589 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13590 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13591 | if (err < 0) |
| 13592 | return err; |
| 13593 | return 0; |
| 13594 | } |
| 13595 | |
| 13596 | /* add playback controls from the parsed DAC table */ |
| 13597 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13598 | const struct auto_pin_cfg *cfg) |
| 13599 | { |
| 13600 | hda_nid_t nid; |
| 13601 | int err; |
| 13602 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13603 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13604 | |
| 13605 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13606 | if (nid) { |
| 13607 | const char *name; |
| 13608 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13609 | name = "Speaker"; |
| 13610 | else |
| 13611 | name = "Front"; |
| 13612 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13613 | if (err < 0) |
| 13614 | return err; |
| 13615 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13616 | |
| 13617 | nid = cfg->speaker_pins[0]; |
| 13618 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13619 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13620 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13621 | if (err < 0) |
| 13622 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13623 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13624 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13625 | if (err < 0) |
| 13626 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13627 | } |
| 13628 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13629 | if (nid) { |
| 13630 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13631 | if (err < 0) |
| 13632 | return err; |
| 13633 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13634 | |
| 13635 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13636 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13637 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13638 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13639 | if (err < 0) |
| 13640 | return err; |
| 13641 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13642 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13643 | } |
| 13644 | |
| 13645 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13646 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13647 | const struct auto_pin_cfg *cfg) |
| 13648 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13649 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13650 | } |
| 13651 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13652 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13653 | hda_nid_t nid, int pin_type) |
| 13654 | { |
| 13655 | int idx; |
| 13656 | |
| 13657 | alc_set_pin_output(codec, nid, pin_type); |
| 13658 | if (nid == 0x14 || nid == 0x16) |
| 13659 | idx = 0; |
| 13660 | else |
| 13661 | idx = 1; |
| 13662 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13663 | } |
| 13664 | |
| 13665 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13666 | { |
| 13667 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13668 | int i; |
| 13669 | |
| 13670 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13671 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13672 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13673 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13674 | } |
| 13675 | } |
| 13676 | |
| 13677 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13678 | { |
| 13679 | struct alc_spec *spec = codec->spec; |
| 13680 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13681 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13682 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13683 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13684 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13685 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13686 | } |
| 13687 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13688 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13689 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13690 | } |
| 13691 | if (spec->autocfg.mono_out_pin) |
| 13692 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13693 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13694 | } |
| 13695 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13696 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13697 | { |
| 13698 | struct alc_spec *spec = codec->spec; |
| 13699 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13700 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13701 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13702 | unsigned int dac_vol1, dac_vol2; |
| 13703 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13704 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13705 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13706 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13707 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13708 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13709 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13710 | AMP_IN_UNMUTE(1)); |
| 13711 | snd_hda_codec_write(codec, 0x10, 0, |
| 13712 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13713 | AMP_IN_UNMUTE(1)); |
| 13714 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13715 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13716 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13717 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13718 | snd_hda_codec_write(codec, 0x10, 0, |
| 13719 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13720 | } |
| 13721 | |
| 13722 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13723 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13724 | dac_vol2 = AMP_OUT_ZERO; |
| 13725 | else if (line_nid == 0x15) |
| 13726 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13727 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13728 | dac_vol2 = AMP_OUT_ZERO; |
| 13729 | else if (hp_nid == 0x15) |
| 13730 | dac_vol1 = AMP_OUT_ZERO; |
| 13731 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13732 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13733 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13734 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13735 | |
| 13736 | snd_hda_codec_write(codec, 0x02, 0, |
| 13737 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13738 | snd_hda_codec_write(codec, 0x03, 0, |
| 13739 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13740 | } |
| 13741 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13742 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13743 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13744 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13745 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13746 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13747 | |
| 13748 | /* |
| 13749 | * BIOS auto configuration |
| 13750 | */ |
| 13751 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13752 | { |
| 13753 | struct alc_spec *spec = codec->spec; |
| 13754 | int err; |
| 13755 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13756 | |
| 13757 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13758 | alc268_ignore); |
| 13759 | if (err < 0) |
| 13760 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13761 | if (!spec->autocfg.line_outs) { |
| 13762 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13763 | spec->multiout.max_channels = 2; |
| 13764 | spec->no_analog = 1; |
| 13765 | goto dig_only; |
| 13766 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13767 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13768 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13769 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13770 | if (err < 0) |
| 13771 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13772 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13773 | if (err < 0) |
| 13774 | return err; |
| 13775 | |
| 13776 | spec->multiout.max_channels = 2; |
| 13777 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13778 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13779 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13780 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13781 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13782 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13783 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13784 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13785 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13786 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13787 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13788 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13789 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13790 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13791 | err = alc_auto_add_mic_boost(codec); |
| 13792 | if (err < 0) |
| 13793 | return err; |
| 13794 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13795 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13796 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13797 | return 1; |
| 13798 | } |
| 13799 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13800 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13801 | |
| 13802 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13803 | static void alc268_auto_init(struct hda_codec *codec) |
| 13804 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13805 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13806 | alc268_auto_init_multi_out(codec); |
| 13807 | alc268_auto_init_hp_out(codec); |
| 13808 | alc268_auto_init_mono_speaker_out(codec); |
| 13809 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13810 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13811 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13812 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13813 | } |
| 13814 | |
| 13815 | /* |
| 13816 | * configuration and preset |
| 13817 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13818 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13819 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13820 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13821 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13822 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13823 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13824 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13825 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13826 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13827 | #ifdef CONFIG_SND_DEBUG |
| 13828 | [ALC268_TEST] = "test", |
| 13829 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13830 | [ALC268_AUTO] = "auto", |
| 13831 | }; |
| 13832 | |
| 13833 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13834 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13835 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13836 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13837 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13838 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13839 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13840 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13841 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13842 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13843 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13844 | /* almost compatible with toshiba but with optional digital outs; |
| 13845 | * auto-probing seems working fine |
| 13846 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13847 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13848 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13849 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13850 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13851 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13852 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13853 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13854 | {} |
| 13855 | }; |
| 13856 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13857 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13858 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13859 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13860 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13861 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13862 | ALC268_TOSHIBA), |
| 13863 | {} |
| 13864 | }; |
| 13865 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13866 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13867 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13868 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13869 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13870 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13871 | alc267_quanta_il1_verbs }, |
| 13872 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13873 | .dac_nids = alc268_dac_nids, |
| 13874 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13875 | .adc_nids = alc268_adc_nids_alt, |
| 13876 | .hp_nid = 0x03, |
| 13877 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13878 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13879 | .unsol_event = alc_sku_unsol_event, |
| 13880 | .setup = alc267_quanta_il1_setup, |
| 13881 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13882 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13883 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13884 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13885 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13886 | .init_verbs = { alc268_base_init_verbs }, |
| 13887 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13888 | .dac_nids = alc268_dac_nids, |
| 13889 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13890 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13891 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13892 | .hp_nid = 0x03, |
| 13893 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13894 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13895 | .channel_mode = alc268_modes, |
| 13896 | .input_mux = &alc268_capture_source, |
| 13897 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13898 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13899 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13900 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13901 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13902 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13903 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13904 | .dac_nids = alc268_dac_nids, |
| 13905 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13906 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13907 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13908 | .hp_nid = 0x03, |
| 13909 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13910 | .channel_mode = alc268_modes, |
| 13911 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13912 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13913 | .setup = alc268_toshiba_setup, |
| 13914 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13915 | }, |
| 13916 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13917 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13918 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13919 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13920 | alc268_acer_verbs }, |
| 13921 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13922 | .dac_nids = alc268_dac_nids, |
| 13923 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13924 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13925 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13926 | .hp_nid = 0x02, |
| 13927 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13928 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13929 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13930 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13931 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13932 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13933 | [ALC268_ACER_DMIC] = { |
| 13934 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13935 | alc268_beep_mixer }, |
| 13936 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13937 | alc268_acer_verbs }, |
| 13938 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13939 | .dac_nids = alc268_dac_nids, |
| 13940 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13941 | .adc_nids = alc268_adc_nids_alt, |
| 13942 | .capsrc_nids = alc268_capsrc_nids, |
| 13943 | .hp_nid = 0x02, |
| 13944 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13945 | .channel_mode = alc268_modes, |
| 13946 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13947 | .unsol_event = alc268_acer_unsol_event, |
| 13948 | .init_hook = alc268_acer_init_hook, |
| 13949 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13950 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13951 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13952 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13953 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13954 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13955 | alc268_acer_aspire_one_verbs }, |
| 13956 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13957 | .dac_nids = alc268_dac_nids, |
| 13958 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13959 | .adc_nids = alc268_adc_nids_alt, |
| 13960 | .capsrc_nids = alc268_capsrc_nids, |
| 13961 | .hp_nid = 0x03, |
| 13962 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13963 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13964 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13965 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13966 | .init_hook = alc268_acer_lc_init_hook, |
| 13967 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13968 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13969 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13970 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13971 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13972 | alc268_dell_verbs }, |
| 13973 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13974 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13975 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13976 | .adc_nids = alc268_adc_nids_alt, |
| 13977 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13978 | .hp_nid = 0x02, |
| 13979 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13980 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13981 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13982 | .setup = alc268_dell_setup, |
| 13983 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13984 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13985 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13986 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13987 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13988 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13989 | alc268_toshiba_verbs }, |
| 13990 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13991 | .dac_nids = alc268_dac_nids, |
| 13992 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13993 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13994 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13995 | .hp_nid = 0x03, |
| 13996 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13997 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13998 | .channel_mode = alc268_modes, |
| 13999 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14000 | .setup = alc268_toshiba_setup, |
| 14001 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 14002 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 14003 | #ifdef CONFIG_SND_DEBUG |
| 14004 | [ALC268_TEST] = { |
| 14005 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 14006 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 14007 | alc268_volume_init_verbs }, |
| 14008 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 14009 | .dac_nids = alc268_dac_nids, |
| 14010 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 14011 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14012 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 14013 | .hp_nid = 0x03, |
| 14014 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 14015 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 14016 | .channel_mode = alc268_modes, |
| 14017 | .input_mux = &alc268_capture_source, |
| 14018 | }, |
| 14019 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14020 | }; |
| 14021 | |
| 14022 | static int patch_alc268(struct hda_codec *codec) |
| 14023 | { |
| 14024 | struct alc_spec *spec; |
| 14025 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14026 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14027 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 14028 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14029 | if (spec == NULL) |
| 14030 | return -ENOMEM; |
| 14031 | |
| 14032 | codec->spec = spec; |
| 14033 | |
| 14034 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 14035 | alc268_models, |
| 14036 | alc268_cfg_tbl); |
| 14037 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14038 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 14039 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 14040 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14041 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14042 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14043 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14044 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14045 | board_config = ALC268_AUTO; |
| 14046 | } |
| 14047 | |
| 14048 | if (board_config == ALC268_AUTO) { |
| 14049 | /* automatic parse from the BIOS config */ |
| 14050 | err = alc268_parse_auto_config(codec); |
| 14051 | if (err < 0) { |
| 14052 | alc_free(codec); |
| 14053 | return err; |
| 14054 | } else if (!err) { |
| 14055 | printk(KERN_INFO |
| 14056 | "hda_codec: Cannot set up configuration " |
| 14057 | "from BIOS. Using base mode...\n"); |
| 14058 | board_config = ALC268_3ST; |
| 14059 | } |
| 14060 | } |
| 14061 | |
| 14062 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14063 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14064 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14065 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 14066 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 14067 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14068 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14069 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 14070 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14071 | has_beep = 0; |
| 14072 | for (i = 0; i < spec->num_mixers; i++) { |
| 14073 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 14074 | has_beep = 1; |
| 14075 | break; |
| 14076 | } |
| 14077 | } |
| 14078 | |
| 14079 | if (has_beep) { |
| 14080 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14081 | if (err < 0) { |
| 14082 | alc_free(codec); |
| 14083 | return err; |
| 14084 | } |
| 14085 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14086 | /* override the amp caps for beep generator */ |
| 14087 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14088 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14089 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14090 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14091 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14092 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14093 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14094 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14095 | /* check whether NID 0x07 is valid */ |
| 14096 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14097 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14098 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14099 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14100 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14101 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14102 | if (spec->auto_mic || |
| 14103 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14104 | spec->adc_nids = alc268_adc_nids_alt; |
| 14105 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14106 | if (spec->auto_mic) |
| 14107 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14108 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14109 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14110 | else |
| 14111 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14112 | } else { |
| 14113 | spec->adc_nids = alc268_adc_nids; |
| 14114 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14115 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14116 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14117 | /* set default input source */ |
| 14118 | for (i = 0; i < spec->num_adc_nids; i++) |
| 14119 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 14120 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 14121 | i < spec->num_mux_defs ? |
| 14122 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14123 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14124 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14125 | |
| 14126 | spec->vmaster_nid = 0x02; |
| 14127 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14128 | codec->patch_ops = alc_patch_ops; |
| 14129 | if (board_config == ALC268_AUTO) |
| 14130 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14131 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14132 | alc_init_jacks(codec); |
| 14133 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14134 | return 0; |
| 14135 | } |
| 14136 | |
| 14137 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14138 | * ALC269 channel source setting (2 channel) |
| 14139 | */ |
| 14140 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14141 | |
| 14142 | #define alc269_dac_nids alc260_dac_nids |
| 14143 | |
| 14144 | static hda_nid_t alc269_adc_nids[1] = { |
| 14145 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14146 | 0x08, |
| 14147 | }; |
| 14148 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14149 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14150 | 0x23, |
| 14151 | }; |
| 14152 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14153 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14154 | /* ADC1 */ |
| 14155 | 0x09, |
| 14156 | }; |
| 14157 | |
| 14158 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14159 | 0x22, |
| 14160 | }; |
| 14161 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14162 | static hda_nid_t alc269_adc_candidates[] = { |
| 14163 | 0x08, 0x09, 0x07, |
| 14164 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14165 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14166 | #define alc269_modes alc260_modes |
| 14167 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14168 | |
| 14169 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14170 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14171 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14172 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14173 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14174 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14175 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14176 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14177 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14178 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14179 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14180 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14181 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14182 | { } /* end */ |
| 14183 | }; |
| 14184 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14185 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14186 | /* output mixer control */ |
| 14187 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14188 | { |
| 14189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14190 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14191 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14192 | .info = snd_hda_mixer_amp_switch_info, |
| 14193 | .get = snd_hda_mixer_amp_switch_get, |
| 14194 | .put = alc268_acer_master_sw_put, |
| 14195 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14196 | }, |
| 14197 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14198 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14199 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14200 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14201 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14202 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14203 | { } |
| 14204 | }; |
| 14205 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14206 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14207 | /* output mixer control */ |
| 14208 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14209 | { |
| 14210 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14211 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14212 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14213 | .info = snd_hda_mixer_amp_switch_info, |
| 14214 | .get = snd_hda_mixer_amp_switch_get, |
| 14215 | .put = alc268_acer_master_sw_put, |
| 14216 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14217 | }, |
| 14218 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14219 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14220 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14221 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14222 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14223 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14224 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14225 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14226 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14227 | { } |
| 14228 | }; |
| 14229 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14230 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14231 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14232 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14233 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14234 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14235 | { } /* end */ |
| 14236 | }; |
| 14237 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14238 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14239 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14240 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14241 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14242 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14243 | { } /* end */ |
| 14244 | }; |
| 14245 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14246 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14247 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14248 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14249 | { } /* end */ |
| 14250 | }; |
| 14251 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14252 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14253 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14254 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14255 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14256 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14257 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14258 | { } /* end */ |
| 14259 | }; |
| 14260 | |
| 14261 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14262 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14263 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14264 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14265 | { } /* end */ |
| 14266 | }; |
| 14267 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14268 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14269 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14270 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14271 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14272 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14273 | { } /* end */ |
| 14274 | }; |
| 14275 | |
| 14276 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14277 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14278 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14279 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14280 | { } /* end */ |
| 14281 | }; |
| 14282 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14283 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14284 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14285 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14286 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14287 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14288 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14289 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14290 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14291 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14292 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14293 | { } |
| 14294 | }; |
| 14295 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14296 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14297 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14298 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14299 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14300 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14301 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14302 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14303 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14304 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14305 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14306 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14307 | { } |
| 14308 | }; |
| 14309 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14310 | /* toggle speaker-output according to the hp-jack state */ |
| 14311 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14312 | { |
| 14313 | unsigned int present; |
| 14314 | unsigned char bits; |
| 14315 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14316 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14317 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14318 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14319 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14320 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14321 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14322 | |
| 14323 | snd_hda_codec_write(codec, 0x20, 0, |
| 14324 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14325 | snd_hda_codec_write(codec, 0x20, 0, |
| 14326 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14327 | |
| 14328 | snd_hda_codec_write(codec, 0x20, 0, |
| 14329 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14330 | snd_hda_codec_write(codec, 0x20, 0, |
| 14331 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14332 | } |
| 14333 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14334 | /* toggle speaker-output according to the hp-jacks state */ |
| 14335 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14336 | { |
| 14337 | unsigned int present; |
| 14338 | unsigned char bits; |
| 14339 | |
| 14340 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14341 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14342 | |
| 14343 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14344 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14345 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14346 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14347 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14348 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14349 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14350 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14351 | |
| 14352 | snd_hda_codec_write(codec, 0x20, 0, |
| 14353 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14354 | snd_hda_codec_write(codec, 0x20, 0, |
| 14355 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14356 | |
| 14357 | snd_hda_codec_write(codec, 0x20, 0, |
| 14358 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14359 | snd_hda_codec_write(codec, 0x20, 0, |
| 14360 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14361 | } |
| 14362 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14363 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14364 | { |
| 14365 | unsigned int present_laptop; |
| 14366 | unsigned int present_dock; |
| 14367 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14368 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14369 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14370 | |
| 14371 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14372 | if (present_dock) |
| 14373 | snd_hda_codec_write(codec, 0x23, 0, |
| 14374 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14375 | if (present_laptop) |
| 14376 | snd_hda_codec_write(codec, 0x23, 0, |
| 14377 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14378 | if (!present_dock && !present_laptop) |
| 14379 | snd_hda_codec_write(codec, 0x23, 0, |
| 14380 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14381 | } |
| 14382 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14383 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14384 | unsigned int res) |
| 14385 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14386 | switch (res >> 26) { |
| 14387 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14388 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14389 | break; |
| 14390 | case ALC880_MIC_EVENT: |
| 14391 | alc_mic_automute(codec); |
| 14392 | break; |
| 14393 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14394 | } |
| 14395 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14396 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14397 | unsigned int res) |
| 14398 | { |
| 14399 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14400 | alc269_lifebook_speaker_automute(codec); |
| 14401 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14402 | alc269_lifebook_mic_autoswitch(codec); |
| 14403 | } |
| 14404 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14405 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14406 | { |
| 14407 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14408 | spec->autocfg.hp_pins[0] = 0x15; |
| 14409 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14410 | spec->ext_mic.pin = 0x18; |
| 14411 | spec->ext_mic.mux_idx = 0; |
| 14412 | spec->int_mic.pin = 0x19; |
| 14413 | spec->int_mic.mux_idx = 1; |
| 14414 | spec->auto_mic = 1; |
| 14415 | } |
| 14416 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14417 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14418 | { |
| 14419 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14420 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14421 | } |
| 14422 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14423 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14424 | { |
| 14425 | alc269_lifebook_speaker_automute(codec); |
| 14426 | alc269_lifebook_mic_autoswitch(codec); |
| 14427 | } |
| 14428 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14429 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14430 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14431 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14432 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14433 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14434 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14435 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14436 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14437 | {} |
| 14438 | }; |
| 14439 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14440 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14441 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14442 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14443 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14444 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14445 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14446 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14447 | {} |
| 14448 | }; |
| 14449 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14450 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14451 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14452 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14453 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14454 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14455 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14456 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14457 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14458 | {} |
| 14459 | }; |
| 14460 | |
| 14461 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14462 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14463 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14464 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14465 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14466 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14467 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14468 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14469 | {} |
| 14470 | }; |
| 14471 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14472 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14473 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14474 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14475 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14476 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14477 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14478 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14479 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14480 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14481 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14482 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14483 | { } |
| 14484 | }; |
| 14485 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14486 | /* toggle speaker-output according to the hp-jack state */ |
| 14487 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14488 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14489 | struct alc_spec *spec = codec->spec; |
| 14490 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14491 | unsigned int present; |
| 14492 | unsigned char bits; |
| 14493 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14494 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14495 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14496 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14497 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14498 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14499 | HDA_AMP_MUTE, bits); |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14500 | alc_report_jack(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14501 | } |
| 14502 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14503 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14504 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14505 | unsigned int res) |
| 14506 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14507 | switch (res >> 26) { |
| 14508 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14509 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14510 | break; |
| 14511 | case ALC880_MIC_EVENT: |
| 14512 | alc_mic_automute(codec); |
| 14513 | break; |
| 14514 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14515 | } |
| 14516 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14517 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14518 | { |
| 14519 | struct alc_spec *spec = codec->spec; |
| 14520 | spec->autocfg.hp_pins[0] = 0x15; |
| 14521 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14522 | spec->ext_mic.pin = 0x18; |
| 14523 | spec->ext_mic.mux_idx = 0; |
| 14524 | spec->int_mic.pin = 0x19; |
| 14525 | spec->int_mic.mux_idx = 1; |
| 14526 | spec->auto_mic = 1; |
| 14527 | } |
| 14528 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14529 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14530 | { |
| 14531 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14532 | spec->autocfg.hp_pins[0] = 0x15; |
| 14533 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14534 | spec->ext_mic.pin = 0x18; |
| 14535 | spec->ext_mic.mux_idx = 0; |
| 14536 | spec->int_mic.pin = 0x12; |
| 14537 | spec->int_mic.mux_idx = 5; |
| 14538 | spec->auto_mic = 1; |
| 14539 | } |
| 14540 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14541 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14542 | { |
| 14543 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14544 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14545 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14546 | spec->ext_mic.pin = 0x18; |
| 14547 | spec->ext_mic.mux_idx = 0; |
| 14548 | spec->int_mic.pin = 0x19; |
| 14549 | spec->int_mic.mux_idx = 1; |
| 14550 | spec->auto_mic = 1; |
| 14551 | } |
| 14552 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14553 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14554 | { |
| 14555 | struct alc_spec *spec = codec->spec; |
| 14556 | spec->autocfg.hp_pins[0] = 0x21; |
| 14557 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14558 | spec->ext_mic.pin = 0x18; |
| 14559 | spec->ext_mic.mux_idx = 0; |
| 14560 | spec->int_mic.pin = 0x12; |
| 14561 | spec->int_mic.mux_idx = 6; |
| 14562 | spec->auto_mic = 1; |
| 14563 | } |
| 14564 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14565 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14566 | { |
| 14567 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14568 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14569 | } |
| 14570 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14571 | /* |
| 14572 | * generic initialization of ADC, input mixers and output mixers |
| 14573 | */ |
| 14574 | static struct hda_verb alc269_init_verbs[] = { |
| 14575 | /* |
| 14576 | * Unmute ADC0 and set the default input to mic-in |
| 14577 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14578 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14579 | |
| 14580 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14581 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14582 | */ |
| 14583 | /* set vol=0 to output mixers */ |
| 14584 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14585 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14586 | |
| 14587 | /* set up input amps for analog loopback */ |
| 14588 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14589 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14591 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14592 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14593 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14594 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14595 | |
| 14596 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14597 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14598 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14599 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14600 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14601 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14602 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14603 | |
| 14604 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14605 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14606 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14607 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14608 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14609 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14610 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14611 | |
| 14612 | /* set EAPD */ |
| 14613 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14614 | { } |
| 14615 | }; |
| 14616 | |
| 14617 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14618 | /* |
| 14619 | * Unmute ADC0 and set the default input to mic-in |
| 14620 | */ |
| 14621 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14622 | |
| 14623 | /* |
| 14624 | * Set up output mixers (0x02 - 0x03) |
| 14625 | */ |
| 14626 | /* set vol=0 to output mixers */ |
| 14627 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14628 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14629 | |
| 14630 | /* set up input amps for analog loopback */ |
| 14631 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14632 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14633 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14634 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14635 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14636 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14637 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14638 | |
| 14639 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14640 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14641 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14642 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14643 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14644 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14645 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14646 | |
| 14647 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14648 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14649 | |
| 14650 | /* FIXME: use Mux-type input source selection */ |
| 14651 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14652 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14653 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14654 | |
| 14655 | /* set EAPD */ |
| 14656 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14657 | { } |
| 14658 | }; |
| 14659 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14660 | #define alc269_auto_create_multi_out_ctls \ |
| 14661 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14662 | #define alc269_auto_create_input_ctls \ |
| 14663 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14664 | |
| 14665 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14666 | #define alc269_loopbacks alc880_loopbacks |
| 14667 | #endif |
| 14668 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14669 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14670 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14671 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14672 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14673 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14674 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14675 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14676 | .substreams = 1, |
| 14677 | .channels_min = 2, |
| 14678 | .channels_max = 8, |
| 14679 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14680 | /* NID is set in alc_build_pcms */ |
| 14681 | .ops = { |
| 14682 | .open = alc880_playback_pcm_open, |
| 14683 | .prepare = alc880_playback_pcm_prepare, |
| 14684 | .cleanup = alc880_playback_pcm_cleanup |
| 14685 | }, |
| 14686 | }; |
| 14687 | |
| 14688 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14689 | .substreams = 1, |
| 14690 | .channels_min = 2, |
| 14691 | .channels_max = 2, |
| 14692 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14693 | /* NID is set in alc_build_pcms */ |
| 14694 | }; |
| 14695 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14696 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14697 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14698 | { |
| 14699 | switch (codec->subsystem_id) { |
| 14700 | case 0x103c1586: |
| 14701 | return 1; |
| 14702 | } |
| 14703 | return 0; |
| 14704 | } |
| 14705 | |
| 14706 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14707 | { |
| 14708 | /* update mute-LED according to the speaker mute state */ |
| 14709 | if (nid == 0x01 || nid == 0x14) { |
| 14710 | int pinval; |
| 14711 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14712 | HDA_AMP_MUTE) |
| 14713 | pinval = 0x24; |
| 14714 | else |
| 14715 | pinval = 0x20; |
| 14716 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14717 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14718 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14719 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14720 | } |
| 14721 | return alc_check_power_status(codec, nid); |
| 14722 | } |
| 14723 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14724 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14725 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14726 | { |
| 14727 | struct alc_spec *spec = codec->spec; |
| 14728 | |
| 14729 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14730 | return 0; |
| 14731 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14732 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14733 | if (spec->ext_mic.pin <= 0x12) { |
| 14734 | spec->private_adc_nids[0] = 0x08; |
| 14735 | spec->private_adc_nids[1] = 0x11; |
| 14736 | spec->private_capsrc_nids[0] = 0x23; |
| 14737 | spec->private_capsrc_nids[1] = 0x22; |
| 14738 | } else { |
| 14739 | spec->private_adc_nids[0] = 0x11; |
| 14740 | spec->private_adc_nids[1] = 0x08; |
| 14741 | spec->private_capsrc_nids[0] = 0x22; |
| 14742 | spec->private_capsrc_nids[1] = 0x23; |
| 14743 | } |
| 14744 | spec->adc_nids = spec->private_adc_nids; |
| 14745 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14746 | spec->num_adc_nids = 2; |
| 14747 | spec->dual_adc_switch = 1; |
| 14748 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14749 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14750 | return 1; |
| 14751 | } |
| 14752 | return 0; |
| 14753 | } |
| 14754 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14755 | /* different alc269-variants */ |
| 14756 | enum { |
| 14757 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14758 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14759 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14760 | ALC269_TYPE_ALC269VB, |
| 14761 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14762 | ALC269_TYPE_ALC271X, |
| 14763 | }; |
| 14764 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14765 | /* |
| 14766 | * BIOS auto configuration |
| 14767 | */ |
| 14768 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14769 | { |
| 14770 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14771 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14772 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14773 | |
| 14774 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14775 | alc269_ignore); |
| 14776 | if (err < 0) |
| 14777 | return err; |
| 14778 | |
| 14779 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14780 | if (err < 0) |
| 14781 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14782 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14783 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14784 | else |
| 14785 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14786 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14787 | if (err < 0) |
| 14788 | return err; |
| 14789 | |
| 14790 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14791 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14792 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14793 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14794 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14795 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14796 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14797 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14798 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14799 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14800 | } else { |
| 14801 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14802 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14803 | } |
| 14804 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14805 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14806 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14807 | |
| 14808 | if (!alc275_setup_dual_adc(codec)) |
| 14809 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14810 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14811 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14812 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14813 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14814 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14815 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14816 | |
| 14817 | err = alc_auto_add_mic_boost(codec); |
| 14818 | if (err < 0) |
| 14819 | return err; |
| 14820 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14821 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14822 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14823 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14824 | return 1; |
| 14825 | } |
| 14826 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14827 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14828 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14829 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14830 | |
| 14831 | |
| 14832 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14833 | static void alc269_auto_init(struct hda_codec *codec) |
| 14834 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14835 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14836 | alc269_auto_init_multi_out(codec); |
| 14837 | alc269_auto_init_hp_out(codec); |
| 14838 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14839 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14840 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14841 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14842 | } |
| 14843 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14844 | #ifdef SND_HDA_NEEDS_RESUME |
| 14845 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14846 | { |
| 14847 | int val = alc_read_coef_idx(codec, 0x04); |
| 14848 | if (power_up) |
| 14849 | val |= 1 << 11; |
| 14850 | else |
| 14851 | val &= ~(1 << 11); |
| 14852 | alc_write_coef_idx(codec, 0x04, val); |
| 14853 | } |
| 14854 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14855 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14856 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14857 | { |
| 14858 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14859 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14860 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14861 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14862 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14863 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14864 | msleep(150); |
| 14865 | } |
| 14866 | |
| 14867 | alc_shutup(codec); |
| 14868 | if (spec && spec->power_hook) |
| 14869 | spec->power_hook(codec); |
| 14870 | return 0; |
| 14871 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14872 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14873 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14874 | static int alc269_resume(struct hda_codec *codec) |
| 14875 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14876 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14877 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14878 | msleep(150); |
| 14879 | } |
| 14880 | |
| 14881 | codec->patch_ops.init(codec); |
| 14882 | |
| 14883 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14884 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14885 | msleep(200); |
| 14886 | } |
| 14887 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14888 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14889 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14890 | |
| 14891 | snd_hda_codec_resume_amp(codec); |
| 14892 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14893 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14894 | return 0; |
| 14895 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14896 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14897 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14898 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14899 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14900 | { |
| 14901 | int coef; |
| 14902 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14903 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14904 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14905 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14906 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14907 | } |
| 14908 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14909 | enum { |
| 14910 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14911 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14912 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14913 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14914 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14915 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14916 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14917 | }; |
| 14918 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14919 | static const struct alc_fixup alc269_fixups[] = { |
| 14920 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14921 | .type = ALC_FIXUP_VERBS, |
| 14922 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14923 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14924 | {} |
| 14925 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14926 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14927 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14928 | .type = ALC_FIXUP_VERBS, |
| 14929 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14930 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14931 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14932 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14933 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14934 | }, |
| 14935 | .chained = true, |
| 14936 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14937 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14938 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14939 | .type = ALC_FIXUP_VERBS, |
| 14940 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14941 | /* Enables internal speaker */ |
| 14942 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14943 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14944 | {} |
| 14945 | } |
| 14946 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14947 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14948 | .type = ALC_FIXUP_SKU, |
| 14949 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14950 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14951 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14952 | .type = ALC_FIXUP_PINS, |
| 14953 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14954 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14955 | { } |
| 14956 | } |
| 14957 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14958 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14959 | .type = ALC_FIXUP_VERBS, |
| 14960 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14961 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14962 | {} |
| 14963 | } |
| 14964 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14965 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14966 | .type = ALC_FIXUP_FUNC, |
| 14967 | .v.func = alc269_fixup_hweq, |
| 14968 | .chained = true, |
| 14969 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14970 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14971 | }; |
| 14972 | |
| 14973 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14974 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14975 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14976 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14977 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14978 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14979 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14980 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14981 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14982 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14983 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14984 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14985 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14986 | {} |
| 14987 | }; |
| 14988 | |
| 14989 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14990 | /* |
| 14991 | * configuration and preset |
| 14992 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14993 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14994 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14995 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14996 | [ALC269_AMIC] = "laptop-amic", |
| 14997 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14998 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14999 | [ALC269_LIFEBOOK] = "lifebook", |
| 15000 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15001 | }; |
| 15002 | |
| 15003 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15004 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15005 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15006 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15007 | ALC269_AMIC), |
| 15008 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 15009 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 15010 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 15011 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 15012 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 15013 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 15014 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 15015 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 15016 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 15017 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 15018 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 15019 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 15020 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 15021 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 15022 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 15023 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 15024 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 15025 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 15026 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 15027 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 15028 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 15029 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 15030 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 15031 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 15032 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 15033 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 15034 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 15035 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 15036 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 15037 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 15038 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 15039 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 15040 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 15041 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 15042 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 15043 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15044 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15045 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15046 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15047 | ALC269_DMIC), |
| 15048 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 15049 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15050 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15051 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 15052 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 15053 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 15054 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 15055 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 15056 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 15057 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15058 | {} |
| 15059 | }; |
| 15060 | |
| 15061 | static struct alc_config_preset alc269_presets[] = { |
| 15062 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15063 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15064 | .init_verbs = { alc269_init_verbs }, |
| 15065 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15066 | .dac_nids = alc269_dac_nids, |
| 15067 | .hp_nid = 0x03, |
| 15068 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15069 | .channel_mode = alc269_modes, |
| 15070 | .input_mux = &alc269_capture_source, |
| 15071 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15072 | [ALC269_QUANTA_FL1] = { |
| 15073 | .mixers = { alc269_quanta_fl1_mixer }, |
| 15074 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 15075 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15076 | .dac_nids = alc269_dac_nids, |
| 15077 | .hp_nid = 0x03, |
| 15078 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15079 | .channel_mode = alc269_modes, |
| 15080 | .input_mux = &alc269_capture_source, |
| 15081 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15082 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15083 | .init_hook = alc269_quanta_fl1_init_hook, |
| 15084 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15085 | [ALC269_AMIC] = { |
| 15086 | .mixers = { alc269_laptop_mixer }, |
| 15087 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15088 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15089 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15090 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15091 | .dac_nids = alc269_dac_nids, |
| 15092 | .hp_nid = 0x03, |
| 15093 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15094 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15095 | .unsol_event = alc269_laptop_unsol_event, |
| 15096 | .setup = alc269_laptop_amic_setup, |
| 15097 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15098 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15099 | [ALC269_DMIC] = { |
| 15100 | .mixers = { alc269_laptop_mixer }, |
| 15101 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15102 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15103 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15104 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15105 | .dac_nids = alc269_dac_nids, |
| 15106 | .hp_nid = 0x03, |
| 15107 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15108 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15109 | .unsol_event = alc269_laptop_unsol_event, |
| 15110 | .setup = alc269_laptop_dmic_setup, |
| 15111 | .init_hook = alc269_laptop_inithook, |
| 15112 | }, |
| 15113 | [ALC269VB_AMIC] = { |
| 15114 | .mixers = { alc269vb_laptop_mixer }, |
| 15115 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15116 | .init_verbs = { alc269vb_init_verbs, |
| 15117 | alc269vb_laptop_amic_init_verbs }, |
| 15118 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15119 | .dac_nids = alc269_dac_nids, |
| 15120 | .hp_nid = 0x03, |
| 15121 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15122 | .channel_mode = alc269_modes, |
| 15123 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15124 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15125 | .init_hook = alc269_laptop_inithook, |
| 15126 | }, |
| 15127 | [ALC269VB_DMIC] = { |
| 15128 | .mixers = { alc269vb_laptop_mixer }, |
| 15129 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15130 | .init_verbs = { alc269vb_init_verbs, |
| 15131 | alc269vb_laptop_dmic_init_verbs }, |
| 15132 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15133 | .dac_nids = alc269_dac_nids, |
| 15134 | .hp_nid = 0x03, |
| 15135 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15136 | .channel_mode = alc269_modes, |
| 15137 | .unsol_event = alc269_laptop_unsol_event, |
| 15138 | .setup = alc269vb_laptop_dmic_setup, |
| 15139 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15140 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15141 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15142 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15143 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15144 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15145 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15146 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15147 | .dac_nids = alc269_dac_nids, |
| 15148 | .hp_nid = 0x03, |
| 15149 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15150 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15151 | .unsol_event = alc269_laptop_unsol_event, |
| 15152 | .setup = alc269_laptop_dmic_setup, |
| 15153 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15154 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15155 | [ALC269_LIFEBOOK] = { |
| 15156 | .mixers = { alc269_lifebook_mixer }, |
| 15157 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15158 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15159 | .dac_nids = alc269_dac_nids, |
| 15160 | .hp_nid = 0x03, |
| 15161 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15162 | .channel_mode = alc269_modes, |
| 15163 | .input_mux = &alc269_capture_source, |
| 15164 | .unsol_event = alc269_lifebook_unsol_event, |
| 15165 | .init_hook = alc269_lifebook_init_hook, |
| 15166 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15167 | [ALC271_ACER] = { |
| 15168 | .mixers = { alc269_asus_mixer }, |
| 15169 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15170 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15171 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15172 | .dac_nids = alc269_dac_nids, |
| 15173 | .adc_nids = alc262_dmic_adc_nids, |
| 15174 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15175 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15176 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15177 | .channel_mode = alc269_modes, |
| 15178 | .input_mux = &alc269_capture_source, |
| 15179 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15180 | .unsol_event = alc_sku_unsol_event, |
| 15181 | .setup = alc269vb_laptop_dmic_setup, |
| 15182 | .init_hook = alc_inithook, |
| 15183 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15184 | }; |
| 15185 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15186 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15187 | { |
| 15188 | int val; |
| 15189 | |
| 15190 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15191 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15192 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15193 | } |
| 15194 | |
| 15195 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15196 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15197 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15198 | } |
| 15199 | |
| 15200 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15201 | val = alc_read_coef_idx(codec, 0x04); |
| 15202 | /* Power up output pin */ |
| 15203 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15204 | } |
| 15205 | |
| 15206 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15207 | val = alc_read_coef_idx(codec, 0xd); |
| 15208 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15209 | /* Capless ramp up clock control */ |
| 15210 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15211 | } |
| 15212 | val = alc_read_coef_idx(codec, 0x17); |
| 15213 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15214 | /* Class D power on reset */ |
| 15215 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15216 | } |
| 15217 | } |
| 15218 | return 0; |
| 15219 | } |
| 15220 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15221 | static int patch_alc269(struct hda_codec *codec) |
| 15222 | { |
| 15223 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15224 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15225 | int err; |
| 15226 | |
| 15227 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15228 | if (spec == NULL) |
| 15229 | return -ENOMEM; |
| 15230 | |
| 15231 | codec->spec = spec; |
| 15232 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15233 | alc_auto_parse_customize_define(codec); |
| 15234 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15235 | if (codec->vendor_id == 0x10ec0269) { |
| 15236 | coef = alc_read_coef_idx(codec, 0); |
| 15237 | if ((coef & 0x00f0) == 0x0010) { |
| 15238 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15239 | spec->cdefine.platform_type == 1) { |
| 15240 | alc_codec_rename(codec, "ALC271X"); |
| 15241 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15242 | } else if ((coef & 0xf000) == 0x1000) { |
| 15243 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15244 | } else if ((coef & 0xf000) == 0x2000) { |
| 15245 | alc_codec_rename(codec, "ALC259"); |
| 15246 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15247 | } else if ((coef & 0xf000) == 0x3000) { |
| 15248 | alc_codec_rename(codec, "ALC258"); |
| 15249 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15250 | } else { |
| 15251 | alc_codec_rename(codec, "ALC269VB"); |
| 15252 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15253 | } |
| 15254 | } else |
| 15255 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15256 | alc269_fill_coef(codec); |
| 15257 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15258 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15259 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15260 | alc269_models, |
| 15261 | alc269_cfg_tbl); |
| 15262 | |
| 15263 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15264 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15265 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15266 | board_config = ALC269_AUTO; |
| 15267 | } |
| 15268 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15269 | if (board_config == ALC269_AUTO) { |
| 15270 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15271 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15272 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15273 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15274 | if (board_config == ALC269_AUTO) { |
| 15275 | /* automatic parse from the BIOS config */ |
| 15276 | err = alc269_parse_auto_config(codec); |
| 15277 | if (err < 0) { |
| 15278 | alc_free(codec); |
| 15279 | return err; |
| 15280 | } else if (!err) { |
| 15281 | printk(KERN_INFO |
| 15282 | "hda_codec: Cannot set up configuration " |
| 15283 | "from BIOS. Using base mode...\n"); |
| 15284 | board_config = ALC269_BASIC; |
| 15285 | } |
| 15286 | } |
| 15287 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15288 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15289 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15290 | if (err < 0) { |
| 15291 | alc_free(codec); |
| 15292 | return err; |
| 15293 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15294 | } |
| 15295 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15296 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15297 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15298 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15299 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15300 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15301 | * fix the sample rate of analog I/O to 44.1kHz |
| 15302 | */ |
| 15303 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15304 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15305 | } else if (spec->dual_adc_switch) { |
| 15306 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15307 | /* switch ADC dynamically */ |
| 15308 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15309 | } else { |
| 15310 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15311 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15312 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15313 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15314 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15315 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15316 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15317 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15318 | spec->adc_nids = alc269_adc_nids; |
| 15319 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15320 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15321 | } else { |
| 15322 | spec->adc_nids = alc269vb_adc_nids; |
| 15323 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15324 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15325 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15326 | } |
| 15327 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15328 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15329 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15330 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15331 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15332 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15333 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15334 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15335 | spec->vmaster_nid = 0x02; |
| 15336 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15337 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15338 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15339 | codec->patch_ops.suspend = alc269_suspend; |
| 15340 | #endif |
| 15341 | #ifdef SND_HDA_NEEDS_RESUME |
| 15342 | codec->patch_ops.resume = alc269_resume; |
| 15343 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15344 | if (board_config == ALC269_AUTO) |
| 15345 | spec->init_hook = alc269_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15346 | |
| 15347 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15348 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15349 | if (!spec->loopback.amplist) |
| 15350 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15351 | if (alc269_mic2_for_mute_led(codec)) |
| 15352 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15353 | #endif |
| 15354 | |
| 15355 | return 0; |
| 15356 | } |
| 15357 | |
| 15358 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15359 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15360 | */ |
| 15361 | |
| 15362 | /* |
| 15363 | * set the path ways for 2 channel output |
| 15364 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15365 | */ |
| 15366 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15367 | /* set pin widget 1Ah (line in) for input */ |
| 15368 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15369 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15370 | * the vref |
| 15371 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15372 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15373 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15374 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15375 | #if 0 |
| 15376 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15377 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15378 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15379 | { } /* end */ |
| 15380 | }; |
| 15381 | /* |
| 15382 | * 6ch mode |
| 15383 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15384 | */ |
| 15385 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15386 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15387 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15388 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15389 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15390 | |
| 15391 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15392 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15393 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15394 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15395 | #if 0 |
| 15396 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15397 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15398 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15399 | { } /* end */ |
| 15400 | }; |
| 15401 | |
| 15402 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15403 | { 2, alc861_threestack_ch2_init }, |
| 15404 | { 6, alc861_threestack_ch6_init }, |
| 15405 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15406 | /* Set mic1 as input and unmute the mixer */ |
| 15407 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15408 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15409 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15410 | { } /* end */ |
| 15411 | }; |
| 15412 | /* Set mic1 as output and mute mixer */ |
| 15413 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15414 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15415 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15416 | { } /* end */ |
| 15417 | }; |
| 15418 | |
| 15419 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15420 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15421 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15422 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15423 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15424 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15425 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15426 | /* set pin widget 1Ah (line in) for input */ |
| 15427 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15428 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15429 | * the vref |
| 15430 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15431 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15432 | |
| 15433 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15434 | #if 0 |
| 15435 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15436 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15437 | #endif |
| 15438 | { } /* end */ |
| 15439 | }; |
| 15440 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15441 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15442 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15443 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15444 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15445 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15446 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15447 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15448 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15449 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15450 | |
| 15451 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15452 | #if 0 |
| 15453 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15454 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15455 | #endif |
| 15456 | { } /* end */ |
| 15457 | }; |
| 15458 | |
| 15459 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15460 | { 2, alc861_asus_ch2_init }, |
| 15461 | { 6, alc861_asus_ch6_init }, |
| 15462 | }; |
| 15463 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15464 | /* patch-ALC861 */ |
| 15465 | |
| 15466 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15467 | /* output mixer control */ |
| 15468 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15469 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15470 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15471 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15472 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15473 | |
| 15474 | /*Input mixer control */ |
| 15475 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15476 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15477 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15478 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15479 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15480 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15481 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15482 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15483 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15484 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15485 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15486 | { } /* end */ |
| 15487 | }; |
| 15488 | |
| 15489 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15490 | /* output mixer control */ |
| 15491 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15492 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15493 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15494 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15495 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15496 | |
| 15497 | /* Input mixer control */ |
| 15498 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15499 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15500 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15501 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15502 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15503 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15504 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15505 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15506 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15507 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15508 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15509 | { |
| 15510 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15511 | .name = "Channel Mode", |
| 15512 | .info = alc_ch_mode_info, |
| 15513 | .get = alc_ch_mode_get, |
| 15514 | .put = alc_ch_mode_put, |
| 15515 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15516 | }, |
| 15517 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15518 | }; |
| 15519 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15520 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15521 | /* output mixer control */ |
| 15522 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15523 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15524 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15525 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15526 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15527 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15528 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15529 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15530 | /* output mixer control */ |
| 15531 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15532 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15533 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15534 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15535 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15536 | |
| 15537 | /* Input mixer control */ |
| 15538 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15539 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15540 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15541 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15542 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15543 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15544 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15545 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15546 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15547 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15548 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15549 | { |
| 15550 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15551 | .name = "Channel Mode", |
| 15552 | .info = alc_ch_mode_info, |
| 15553 | .get = alc_ch_mode_get, |
| 15554 | .put = alc_ch_mode_put, |
| 15555 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15556 | }, |
| 15557 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15558 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15559 | |
| 15560 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15561 | /* output mixer control */ |
| 15562 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15563 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15564 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15565 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15566 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15567 | |
| 15568 | /* Input mixer control */ |
| 15569 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15570 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15571 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15572 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15573 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15574 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15575 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15576 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15577 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15578 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15579 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15580 | { |
| 15581 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15582 | .name = "Channel Mode", |
| 15583 | .info = alc_ch_mode_info, |
| 15584 | .get = alc_ch_mode_get, |
| 15585 | .put = alc_ch_mode_put, |
| 15586 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15587 | }, |
| 15588 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15589 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15590 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15591 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15592 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15593 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15594 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15595 | { } |
| 15596 | }; |
| 15597 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15598 | /* |
| 15599 | * generic initialization of ADC, input mixers and output mixers |
| 15600 | */ |
| 15601 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15602 | /* |
| 15603 | * Unmute ADC0 and set the default input to mic-in |
| 15604 | */ |
| 15605 | /* port-A for surround (rear panel) */ |
| 15606 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15607 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15608 | /* port-B for mic-in (rear panel) with vref */ |
| 15609 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15610 | /* port-C for line-in (rear panel) */ |
| 15611 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15612 | /* port-D for Front */ |
| 15613 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15614 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15615 | /* port-E for HP out (front panel) */ |
| 15616 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15617 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15618 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15619 | /* port-F for mic-in (front panel) with vref */ |
| 15620 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15621 | /* port-G for CLFE (rear panel) */ |
| 15622 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15623 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15624 | /* port-H for side (rear panel) */ |
| 15625 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15626 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15627 | /* CD-in */ |
| 15628 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15629 | /* route front mic to ADC1*/ |
| 15630 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15631 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15632 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15633 | /* Unmute DAC0~3 & spdif out*/ |
| 15634 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15635 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15636 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15637 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15638 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15639 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15640 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15641 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15642 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15643 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15644 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15645 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15646 | /* Unmute Stereo Mixer 15 */ |
| 15647 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15648 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15649 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15651 | |
| 15652 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15653 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15654 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15655 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15656 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15657 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15658 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15659 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15660 | /* hp used DAC 3 (Front) */ |
| 15661 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15662 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15663 | |
| 15664 | { } |
| 15665 | }; |
| 15666 | |
| 15667 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15668 | /* |
| 15669 | * Unmute ADC0 and set the default input to mic-in |
| 15670 | */ |
| 15671 | /* port-A for surround (rear panel) */ |
| 15672 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15673 | /* port-B for mic-in (rear panel) with vref */ |
| 15674 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15675 | /* port-C for line-in (rear panel) */ |
| 15676 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15677 | /* port-D for Front */ |
| 15678 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15679 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15680 | /* port-E for HP out (front panel) */ |
| 15681 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15682 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15683 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15684 | /* port-F for mic-in (front panel) with vref */ |
| 15685 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15686 | /* port-G for CLFE (rear panel) */ |
| 15687 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15688 | /* port-H for side (rear panel) */ |
| 15689 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15690 | /* CD-in */ |
| 15691 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15692 | /* route front mic to ADC1*/ |
| 15693 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15694 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15695 | /* Unmute DAC0~3 & spdif out*/ |
| 15696 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15697 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15698 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15699 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15700 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15701 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15702 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15703 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15704 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15705 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15706 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15707 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15708 | /* Unmute Stereo Mixer 15 */ |
| 15709 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15710 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15711 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15713 | |
| 15714 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15715 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15716 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15717 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15718 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15719 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15720 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15721 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15722 | /* hp used DAC 3 (Front) */ |
| 15723 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15724 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15725 | { } |
| 15726 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15727 | |
| 15728 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15729 | /* |
| 15730 | * Unmute ADC0 and set the default input to mic-in |
| 15731 | */ |
| 15732 | /* port-A for surround (rear panel) */ |
| 15733 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15734 | /* port-B for mic-in (rear panel) with vref */ |
| 15735 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15736 | /* port-C for line-in (rear panel) */ |
| 15737 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15738 | /* port-D for Front */ |
| 15739 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15740 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15741 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15742 | /* this has to be set to VREF80 */ |
| 15743 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15744 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15745 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15746 | /* port-F for mic-in (front panel) with vref */ |
| 15747 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15748 | /* port-G for CLFE (rear panel) */ |
| 15749 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15750 | /* port-H for side (rear panel) */ |
| 15751 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15752 | /* CD-in */ |
| 15753 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15754 | /* route front mic to ADC1*/ |
| 15755 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15756 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15757 | /* Unmute DAC0~3 & spdif out*/ |
| 15758 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15759 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15760 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15761 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15762 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15763 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15764 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15765 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15766 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15767 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15768 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15769 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15770 | /* Unmute Stereo Mixer 15 */ |
| 15771 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15772 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15775 | |
| 15776 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15777 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15778 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15779 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15780 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15781 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15782 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15783 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15784 | /* hp used DAC 3 (Front) */ |
| 15785 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15786 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15787 | { } |
| 15788 | }; |
| 15789 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15790 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15791 | /* |
| 15792 | * Unmute ADC0 and set the default input to mic-in |
| 15793 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15794 | /* port-A for surround (rear panel) |
| 15795 | * according to codec#0 this is the HP jack |
| 15796 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15797 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15798 | /* route front PCM to HP */ |
| 15799 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15800 | /* port-B for mic-in (rear panel) with vref */ |
| 15801 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15802 | /* port-C for line-in (rear panel) */ |
| 15803 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15804 | /* port-D for Front */ |
| 15805 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15806 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15807 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15808 | /* this has to be set to VREF80 */ |
| 15809 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15810 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15811 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15812 | /* port-F for mic-in (front panel) with vref */ |
| 15813 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15814 | /* port-G for CLFE (rear panel) */ |
| 15815 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15816 | /* port-H for side (rear panel) */ |
| 15817 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15818 | /* CD-in */ |
| 15819 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15820 | /* route front mic to ADC1*/ |
| 15821 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15822 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15823 | /* Unmute DAC0~3 & spdif out*/ |
| 15824 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15825 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15826 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15827 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15828 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15829 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15830 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15831 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15832 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15833 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15834 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15835 | /* Unmute Stereo Mixer 15 */ |
| 15836 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15837 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15838 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15839 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15840 | |
| 15841 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15842 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15843 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15844 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15845 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15846 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15847 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15848 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15849 | /* hp used DAC 3 (Front) */ |
| 15850 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15851 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15852 | { } |
| 15853 | }; |
| 15854 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15855 | /* additional init verbs for ASUS laptops */ |
| 15856 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15857 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15858 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15859 | { } |
| 15860 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15861 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15862 | /* |
| 15863 | * generic initialization of ADC, input mixers and output mixers |
| 15864 | */ |
| 15865 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15866 | /* |
| 15867 | * Unmute ADC0 and set the default input to mic-in |
| 15868 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15869 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15870 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15871 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15872 | /* Unmute DAC0~3 & spdif out*/ |
| 15873 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15874 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15875 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15876 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15877 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15878 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15879 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15880 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15881 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15882 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15883 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15884 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15885 | /* Unmute Stereo Mixer 15 */ |
| 15886 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15887 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15888 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15889 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15890 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15891 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15892 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15893 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15894 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15895 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15896 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15897 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15898 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15899 | |
| 15900 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15901 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15902 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15903 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15904 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15905 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15906 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15907 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15908 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15909 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15910 | |
| 15911 | { } |
| 15912 | }; |
| 15913 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15914 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15915 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15916 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15917 | { } |
| 15918 | }; |
| 15919 | |
| 15920 | /* toggle speaker-output according to the hp-jack state */ |
| 15921 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15922 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15923 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15924 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15925 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15926 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15927 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15928 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15929 | } |
| 15930 | |
| 15931 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15932 | unsigned int res) |
| 15933 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15934 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15935 | alc861_toshiba_automute(codec); |
| 15936 | } |
| 15937 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15938 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15939 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15940 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15941 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15942 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15943 | |
| 15944 | |
| 15945 | #define ALC861_DIGOUT_NID 0x07 |
| 15946 | |
| 15947 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15948 | { 8, NULL } |
| 15949 | }; |
| 15950 | |
| 15951 | static hda_nid_t alc861_dac_nids[4] = { |
| 15952 | /* front, surround, clfe, side */ |
| 15953 | 0x03, 0x06, 0x05, 0x04 |
| 15954 | }; |
| 15955 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15956 | static hda_nid_t alc660_dac_nids[3] = { |
| 15957 | /* front, clfe, surround */ |
| 15958 | 0x03, 0x05, 0x06 |
| 15959 | }; |
| 15960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15961 | static hda_nid_t alc861_adc_nids[1] = { |
| 15962 | /* ADC0-2 */ |
| 15963 | 0x08, |
| 15964 | }; |
| 15965 | |
| 15966 | static struct hda_input_mux alc861_capture_source = { |
| 15967 | .num_items = 5, |
| 15968 | .items = { |
| 15969 | { "Mic", 0x0 }, |
| 15970 | { "Front Mic", 0x3 }, |
| 15971 | { "Line", 0x1 }, |
| 15972 | { "CD", 0x4 }, |
| 15973 | { "Mixer", 0x5 }, |
| 15974 | }, |
| 15975 | }; |
| 15976 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15977 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15978 | { |
| 15979 | struct alc_spec *spec = codec->spec; |
| 15980 | hda_nid_t mix, srcs[5]; |
| 15981 | int i, j, num; |
| 15982 | |
| 15983 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15984 | return 0; |
| 15985 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15986 | if (num < 0) |
| 15987 | return 0; |
| 15988 | for (i = 0; i < num; i++) { |
| 15989 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15990 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15991 | if (type != AC_WID_AUD_OUT) |
| 15992 | continue; |
| 15993 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15994 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15995 | break; |
| 15996 | if (j >= spec->multiout.num_dacs) |
| 15997 | return srcs[i]; |
| 15998 | } |
| 15999 | return 0; |
| 16000 | } |
| 16001 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16002 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16003 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16004 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16005 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16006 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16007 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16008 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16009 | |
| 16010 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 16011 | for (i = 0; i < cfg->line_outs; i++) { |
| 16012 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16013 | dac = alc861_look_for_dac(codec, nid); |
| 16014 | if (!dac) |
| 16015 | continue; |
| 16016 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16017 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16018 | return 0; |
| 16019 | } |
| 16020 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16021 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 16022 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16023 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16024 | return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16025 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 16026 | } |
| 16027 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16028 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 16029 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 16030 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16031 | /* add playback controls from the parsed DAC table */ |
| 16032 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 16033 | const struct auto_pin_cfg *cfg) |
| 16034 | { |
| 16035 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16036 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16037 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16038 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16039 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16040 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16041 | int i, err; |
| 16042 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16043 | for (i = 0; i < cfg->line_outs; i++) { |
| 16044 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16045 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16046 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16047 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16048 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16049 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16050 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16051 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16052 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16053 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16054 | return err; |
| 16055 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16056 | const char *name = pfx; |
| 16057 | if (!name) |
| 16058 | name = chname[i]; |
| 16059 | err = __alc861_create_out_sw(codec, name, nid, i, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16060 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16061 | return err; |
| 16062 | } |
| 16063 | } |
| 16064 | return 0; |
| 16065 | } |
| 16066 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16067 | 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] | 16068 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16069 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16070 | int err; |
| 16071 | hda_nid_t nid; |
| 16072 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16073 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16074 | return 0; |
| 16075 | |
| 16076 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16077 | nid = alc861_look_for_dac(codec, pin); |
| 16078 | if (nid) { |
| 16079 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 16080 | if (err < 0) |
| 16081 | return err; |
| 16082 | spec->multiout.hp_nid = nid; |
| 16083 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16084 | } |
| 16085 | return 0; |
| 16086 | } |
| 16087 | |
| 16088 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16089 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16090 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16091 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16092 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16093 | } |
| 16094 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16095 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16096 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16097 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16098 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16099 | hda_nid_t mix, srcs[5]; |
| 16100 | int i, num; |
| 16101 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16102 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16103 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16104 | 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] | 16105 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16106 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 16107 | return; |
| 16108 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 16109 | if (num < 0) |
| 16110 | return; |
| 16111 | for (i = 0; i < num; i++) { |
| 16112 | unsigned int mute; |
| 16113 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 16114 | mute = AMP_IN_UNMUTE(i); |
| 16115 | else |
| 16116 | mute = AMP_IN_MUTE(i); |
| 16117 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16118 | mute); |
| 16119 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16120 | } |
| 16121 | |
| 16122 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 16123 | { |
| 16124 | struct alc_spec *spec = codec->spec; |
| 16125 | int i; |
| 16126 | |
| 16127 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 16128 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16129 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16130 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16131 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16132 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16133 | } |
| 16134 | } |
| 16135 | |
| 16136 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 16137 | { |
| 16138 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16139 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16140 | if (spec->autocfg.hp_outs) |
| 16141 | alc861_auto_set_output_and_unmute(codec, |
| 16142 | spec->autocfg.hp_pins[0], |
| 16143 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16144 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16145 | if (spec->autocfg.speaker_outs) |
| 16146 | alc861_auto_set_output_and_unmute(codec, |
| 16147 | spec->autocfg.speaker_pins[0], |
| 16148 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16149 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16150 | } |
| 16151 | |
| 16152 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16153 | { |
| 16154 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16155 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16156 | int i; |
| 16157 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16158 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16159 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16160 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16161 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16162 | } |
| 16163 | } |
| 16164 | |
| 16165 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16166 | /* return 1 if successful, 0 if the proper config is not found, |
| 16167 | * or a negative error code |
| 16168 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16169 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16170 | { |
| 16171 | struct alc_spec *spec = codec->spec; |
| 16172 | int err; |
| 16173 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 16174 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16175 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16176 | alc861_ignore); |
| 16177 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16178 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16179 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16180 | return 0; /* can't find valid BIOS pin config */ |
| 16181 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16182 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16183 | if (err < 0) |
| 16184 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16185 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16186 | if (err < 0) |
| 16187 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16188 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16189 | if (err < 0) |
| 16190 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16191 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16192 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16193 | return err; |
| 16194 | |
| 16195 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16196 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16197 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16198 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16199 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16200 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16201 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16202 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16203 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16204 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16205 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16206 | |
| 16207 | spec->adc_nids = alc861_adc_nids; |
| 16208 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16209 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16210 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16211 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16212 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16213 | return 1; |
| 16214 | } |
| 16215 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16216 | /* additional initialization for auto-configuration model */ |
| 16217 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16218 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16219 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16220 | alc861_auto_init_multi_out(codec); |
| 16221 | alc861_auto_init_hp_out(codec); |
| 16222 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16223 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16224 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16225 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16226 | } |
| 16227 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16228 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16229 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16230 | { 0x15, HDA_INPUT, 0 }, |
| 16231 | { 0x15, HDA_INPUT, 1 }, |
| 16232 | { 0x15, HDA_INPUT, 2 }, |
| 16233 | { 0x15, HDA_INPUT, 3 }, |
| 16234 | { } /* end */ |
| 16235 | }; |
| 16236 | #endif |
| 16237 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16238 | |
| 16239 | /* |
| 16240 | * configuration and preset |
| 16241 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16242 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16243 | [ALC861_3ST] = "3stack", |
| 16244 | [ALC660_3ST] = "3stack-660", |
| 16245 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16246 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16247 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16248 | [ALC861_TOSHIBA] = "toshiba", |
| 16249 | [ALC861_ASUS] = "asus", |
| 16250 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16251 | [ALC861_AUTO] = "auto", |
| 16252 | }; |
| 16253 | |
| 16254 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16255 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16256 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16257 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16258 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16259 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16260 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16261 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16262 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16263 | * Any other models that need this preset? |
| 16264 | */ |
| 16265 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16266 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16267 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16268 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16269 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16270 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16271 | /* FIXME: the below seems conflict */ |
| 16272 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16273 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16274 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16275 | {} |
| 16276 | }; |
| 16277 | |
| 16278 | static struct alc_config_preset alc861_presets[] = { |
| 16279 | [ALC861_3ST] = { |
| 16280 | .mixers = { alc861_3ST_mixer }, |
| 16281 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16282 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16283 | .dac_nids = alc861_dac_nids, |
| 16284 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16285 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16286 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16287 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16288 | .adc_nids = alc861_adc_nids, |
| 16289 | .input_mux = &alc861_capture_source, |
| 16290 | }, |
| 16291 | [ALC861_3ST_DIG] = { |
| 16292 | .mixers = { alc861_base_mixer }, |
| 16293 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16294 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16295 | .dac_nids = alc861_dac_nids, |
| 16296 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16297 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16298 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16299 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16300 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16301 | .adc_nids = alc861_adc_nids, |
| 16302 | .input_mux = &alc861_capture_source, |
| 16303 | }, |
| 16304 | [ALC861_6ST_DIG] = { |
| 16305 | .mixers = { alc861_base_mixer }, |
| 16306 | .init_verbs = { alc861_base_init_verbs }, |
| 16307 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16308 | .dac_nids = alc861_dac_nids, |
| 16309 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16310 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16311 | .channel_mode = alc861_8ch_modes, |
| 16312 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16313 | .adc_nids = alc861_adc_nids, |
| 16314 | .input_mux = &alc861_capture_source, |
| 16315 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16316 | [ALC660_3ST] = { |
| 16317 | .mixers = { alc861_3ST_mixer }, |
| 16318 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16319 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16320 | .dac_nids = alc660_dac_nids, |
| 16321 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16322 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16323 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16324 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16325 | .adc_nids = alc861_adc_nids, |
| 16326 | .input_mux = &alc861_capture_source, |
| 16327 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16328 | [ALC861_UNIWILL_M31] = { |
| 16329 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16330 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16331 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16332 | .dac_nids = alc861_dac_nids, |
| 16333 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16334 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16335 | .channel_mode = alc861_uniwill_m31_modes, |
| 16336 | .need_dac_fix = 1, |
| 16337 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16338 | .adc_nids = alc861_adc_nids, |
| 16339 | .input_mux = &alc861_capture_source, |
| 16340 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16341 | [ALC861_TOSHIBA] = { |
| 16342 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16343 | .init_verbs = { alc861_base_init_verbs, |
| 16344 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16345 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16346 | .dac_nids = alc861_dac_nids, |
| 16347 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16348 | .channel_mode = alc883_3ST_2ch_modes, |
| 16349 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16350 | .adc_nids = alc861_adc_nids, |
| 16351 | .input_mux = &alc861_capture_source, |
| 16352 | .unsol_event = alc861_toshiba_unsol_event, |
| 16353 | .init_hook = alc861_toshiba_automute, |
| 16354 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16355 | [ALC861_ASUS] = { |
| 16356 | .mixers = { alc861_asus_mixer }, |
| 16357 | .init_verbs = { alc861_asus_init_verbs }, |
| 16358 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16359 | .dac_nids = alc861_dac_nids, |
| 16360 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16361 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16362 | .channel_mode = alc861_asus_modes, |
| 16363 | .need_dac_fix = 1, |
| 16364 | .hp_nid = 0x06, |
| 16365 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16366 | .adc_nids = alc861_adc_nids, |
| 16367 | .input_mux = &alc861_capture_source, |
| 16368 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16369 | [ALC861_ASUS_LAPTOP] = { |
| 16370 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16371 | .init_verbs = { alc861_asus_init_verbs, |
| 16372 | alc861_asus_laptop_init_verbs }, |
| 16373 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16374 | .dac_nids = alc861_dac_nids, |
| 16375 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16376 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16377 | .channel_mode = alc883_3ST_2ch_modes, |
| 16378 | .need_dac_fix = 1, |
| 16379 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16380 | .adc_nids = alc861_adc_nids, |
| 16381 | .input_mux = &alc861_capture_source, |
| 16382 | }, |
| 16383 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16384 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16385 | /* Pin config fixes */ |
| 16386 | enum { |
| 16387 | PINFIX_FSC_AMILO_PI1505, |
| 16388 | }; |
| 16389 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16390 | static const struct alc_fixup alc861_fixups[] = { |
| 16391 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16392 | .type = ALC_FIXUP_PINS, |
| 16393 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16394 | { 0x0b, 0x0221101f }, /* HP */ |
| 16395 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16396 | { } |
| 16397 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16398 | }, |
| 16399 | }; |
| 16400 | |
| 16401 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16402 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16403 | {} |
| 16404 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16405 | |
| 16406 | static int patch_alc861(struct hda_codec *codec) |
| 16407 | { |
| 16408 | struct alc_spec *spec; |
| 16409 | int board_config; |
| 16410 | int err; |
| 16411 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16412 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16413 | if (spec == NULL) |
| 16414 | return -ENOMEM; |
| 16415 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16416 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16417 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16418 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16419 | alc861_models, |
| 16420 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16421 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16422 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16423 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16424 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16425 | board_config = ALC861_AUTO; |
| 16426 | } |
| 16427 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16428 | if (board_config == ALC861_AUTO) { |
| 16429 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16430 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16431 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16432 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16433 | if (board_config == ALC861_AUTO) { |
| 16434 | /* automatic parse from the BIOS config */ |
| 16435 | err = alc861_parse_auto_config(codec); |
| 16436 | if (err < 0) { |
| 16437 | alc_free(codec); |
| 16438 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16439 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16440 | printk(KERN_INFO |
| 16441 | "hda_codec: Cannot set up configuration " |
| 16442 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16443 | board_config = ALC861_3ST_DIG; |
| 16444 | } |
| 16445 | } |
| 16446 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16447 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16448 | if (err < 0) { |
| 16449 | alc_free(codec); |
| 16450 | return err; |
| 16451 | } |
| 16452 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16453 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16454 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16455 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16456 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16457 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16458 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16459 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16460 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16461 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16462 | if (!spec->cap_mixer) |
| 16463 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16464 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16465 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16466 | spec->vmaster_nid = 0x03; |
| 16467 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16468 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16469 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16470 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16471 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16472 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16473 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16474 | spec->power_hook = alc_power_eapd; |
| 16475 | #endif |
| 16476 | } |
| 16477 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16478 | if (!spec->loopback.amplist) |
| 16479 | spec->loopback.amplist = alc861_loopbacks; |
| 16480 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16481 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16482 | return 0; |
| 16483 | } |
| 16484 | |
| 16485 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16486 | * ALC861-VD support |
| 16487 | * |
| 16488 | * Based on ALC882 |
| 16489 | * |
| 16490 | * In addition, an independent DAC |
| 16491 | */ |
| 16492 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16493 | |
| 16494 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16495 | /* front, surr, clfe, side surr */ |
| 16496 | 0x02, 0x03, 0x04, 0x05 |
| 16497 | }; |
| 16498 | |
| 16499 | /* dac_nids for ALC660vd are in a different order - according to |
| 16500 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16501 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16502 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16503 | * - and it is the same as in 861vd. |
| 16504 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16505 | */ |
| 16506 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16507 | /* front, rear, clfe, rear_surr */ |
| 16508 | 0x02, 0x04, 0x03 |
| 16509 | }; |
| 16510 | |
| 16511 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16512 | /* ADC0 */ |
| 16513 | 0x09, |
| 16514 | }; |
| 16515 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16516 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16517 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16518 | /* input MUX */ |
| 16519 | /* FIXME: should be a matrix-type input source selection */ |
| 16520 | static struct hda_input_mux alc861vd_capture_source = { |
| 16521 | .num_items = 4, |
| 16522 | .items = { |
| 16523 | { "Mic", 0x0 }, |
| 16524 | { "Front Mic", 0x1 }, |
| 16525 | { "Line", 0x2 }, |
| 16526 | { "CD", 0x4 }, |
| 16527 | }, |
| 16528 | }; |
| 16529 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16530 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16531 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16532 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16533 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16534 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16535 | }, |
| 16536 | }; |
| 16537 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16538 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16539 | .num_items = 2, |
| 16540 | .items = { |
| 16541 | { "Front Mic", 0x0 }, |
| 16542 | { "ATAPI Mic", 0x1 }, |
| 16543 | }, |
| 16544 | }; |
| 16545 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16546 | /* |
| 16547 | * 2ch mode |
| 16548 | */ |
| 16549 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16550 | { 2, NULL } |
| 16551 | }; |
| 16552 | |
| 16553 | /* |
| 16554 | * 6ch mode |
| 16555 | */ |
| 16556 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16557 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16558 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16559 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16560 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16561 | { } /* end */ |
| 16562 | }; |
| 16563 | |
| 16564 | /* |
| 16565 | * 8ch mode |
| 16566 | */ |
| 16567 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16568 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16569 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16570 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16571 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16572 | { } /* end */ |
| 16573 | }; |
| 16574 | |
| 16575 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16576 | { 6, alc861vd_6stack_ch6_init }, |
| 16577 | { 8, alc861vd_6stack_ch8_init }, |
| 16578 | }; |
| 16579 | |
| 16580 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16581 | { |
| 16582 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16583 | .name = "Channel Mode", |
| 16584 | .info = alc_ch_mode_info, |
| 16585 | .get = alc_ch_mode_get, |
| 16586 | .put = alc_ch_mode_put, |
| 16587 | }, |
| 16588 | { } /* end */ |
| 16589 | }; |
| 16590 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16591 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16592 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16593 | */ |
| 16594 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16595 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16596 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16597 | |
| 16598 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16599 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16600 | |
| 16601 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16602 | HDA_OUTPUT), |
| 16603 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16604 | HDA_OUTPUT), |
| 16605 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16606 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16607 | |
| 16608 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16609 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16610 | |
| 16611 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16612 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16613 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16615 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16616 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16617 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16618 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16619 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16620 | |
| 16621 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16622 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16623 | |
| 16624 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16625 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16626 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16627 | { } /* end */ |
| 16628 | }; |
| 16629 | |
| 16630 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16631 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16632 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16633 | |
| 16634 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16635 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16636 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16637 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16638 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16639 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16640 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16641 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16642 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16643 | |
| 16644 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16645 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16646 | |
| 16647 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16648 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16649 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16650 | { } /* end */ |
| 16651 | }; |
| 16652 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16653 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16654 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16655 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16656 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16657 | |
| 16658 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16659 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16660 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16661 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16662 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16663 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16664 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16665 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16666 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16667 | |
| 16668 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16669 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16670 | |
| 16671 | { } /* end */ |
| 16672 | }; |
| 16673 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16674 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16675 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16676 | */ |
| 16677 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16678 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16679 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16680 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16681 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16682 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16683 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16684 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16685 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16686 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16687 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16688 | { } /* end */ |
| 16689 | }; |
| 16690 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16691 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16692 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16693 | */ |
| 16694 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16695 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16696 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16697 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16698 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16699 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16700 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16701 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16702 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16703 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16704 | { } /* end */ |
| 16705 | }; |
| 16706 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16707 | /* |
| 16708 | * generic initialization of ADC, input mixers and output mixers |
| 16709 | */ |
| 16710 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16711 | /* |
| 16712 | * Unmute ADC0 and set the default input to mic-in |
| 16713 | */ |
| 16714 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16715 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16716 | |
| 16717 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16718 | * the analog-loopback mixer widget |
| 16719 | */ |
| 16720 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16721 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16725 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16726 | |
| 16727 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16730 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16731 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16732 | |
| 16733 | /* |
| 16734 | * Set up output mixers (0x02 - 0x05) |
| 16735 | */ |
| 16736 | /* set vol=0 to output mixers */ |
| 16737 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16738 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16739 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16740 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16741 | |
| 16742 | /* set up input amps for analog loopback */ |
| 16743 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16744 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16745 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16746 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16747 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16748 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16749 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16750 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16751 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16752 | |
| 16753 | { } |
| 16754 | }; |
| 16755 | |
| 16756 | /* |
| 16757 | * 3-stack pin configuration: |
| 16758 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16759 | */ |
| 16760 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16761 | /* |
| 16762 | * Set pin mode and muting |
| 16763 | */ |
| 16764 | /* set front pin widgets 0x14 for output */ |
| 16765 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16766 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16767 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16768 | |
| 16769 | /* Mic (rear) pin: input vref at 80% */ |
| 16770 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16771 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16772 | /* Front Mic pin: input vref at 80% */ |
| 16773 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16774 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16775 | /* Line In pin: input */ |
| 16776 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16777 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16778 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16779 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16780 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16781 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16782 | /* CD pin widget for input */ |
| 16783 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16784 | |
| 16785 | { } |
| 16786 | }; |
| 16787 | |
| 16788 | /* |
| 16789 | * 6-stack pin configuration: |
| 16790 | */ |
| 16791 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16792 | /* |
| 16793 | * Set pin mode and muting |
| 16794 | */ |
| 16795 | /* set front pin widgets 0x14 for output */ |
| 16796 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16797 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16798 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16799 | |
| 16800 | /* Rear Pin: output 1 (0x0d) */ |
| 16801 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16802 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16803 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16804 | /* CLFE Pin: output 2 (0x0e) */ |
| 16805 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16806 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16807 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16808 | /* Side Pin: output 3 (0x0f) */ |
| 16809 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16810 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16811 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16812 | |
| 16813 | /* Mic (rear) pin: input vref at 80% */ |
| 16814 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16815 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16816 | /* Front Mic pin: input vref at 80% */ |
| 16817 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16818 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16819 | /* Line In pin: input */ |
| 16820 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16821 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16822 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16823 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16824 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16825 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16826 | /* CD pin widget for input */ |
| 16827 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16828 | |
| 16829 | { } |
| 16830 | }; |
| 16831 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16832 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16833 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16834 | { } |
| 16835 | }; |
| 16836 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16837 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16838 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16839 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16840 | { } |
| 16841 | }; |
| 16842 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16843 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16844 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16846 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16847 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16848 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16849 | {} |
| 16850 | }; |
| 16851 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16852 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16853 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16854 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16855 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16856 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16857 | } |
| 16858 | |
| 16859 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16860 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16861 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16862 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16863 | } |
| 16864 | |
| 16865 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16866 | unsigned int res) |
| 16867 | { |
| 16868 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16869 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16870 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16871 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16872 | default: |
| 16873 | alc_automute_amp_unsol_event(codec, res); |
| 16874 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16875 | } |
| 16876 | } |
| 16877 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16878 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16879 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16880 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16881 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16882 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16883 | |
| 16884 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16886 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16887 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16888 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16889 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16890 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16891 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16892 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16893 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16894 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16895 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16896 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16897 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16898 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16899 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16900 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16901 | |
| 16902 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16903 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16904 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16905 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16906 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16907 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16908 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16909 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16910 | |
| 16911 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16912 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16913 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16914 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16915 | |
| 16916 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16917 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16918 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16919 | |
| 16920 | { } /* end */ |
| 16921 | }; |
| 16922 | |
| 16923 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16924 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16925 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16926 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16927 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16928 | spec->autocfg.hp_pins[0] = 0x15; |
| 16929 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16930 | } |
| 16931 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16932 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16933 | #define alc861vd_loopbacks alc880_loopbacks |
| 16934 | #endif |
| 16935 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16936 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16937 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16938 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16939 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16940 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16941 | |
| 16942 | /* |
| 16943 | * configuration and preset |
| 16944 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16945 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16946 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16947 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16948 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16949 | [ALC861VD_3ST] = "3stack", |
| 16950 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16951 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16952 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16953 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16954 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16955 | [ALC861VD_AUTO] = "auto", |
| 16956 | }; |
| 16957 | |
| 16958 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16959 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16960 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16961 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16962 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16963 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16964 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16965 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16966 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16967 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16968 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16969 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16970 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16971 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16972 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16973 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16974 | {} |
| 16975 | }; |
| 16976 | |
| 16977 | static struct alc_config_preset alc861vd_presets[] = { |
| 16978 | [ALC660VD_3ST] = { |
| 16979 | .mixers = { alc861vd_3st_mixer }, |
| 16980 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16981 | alc861vd_3stack_init_verbs }, |
| 16982 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16983 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16984 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16985 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16986 | .input_mux = &alc861vd_capture_source, |
| 16987 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16988 | [ALC660VD_3ST_DIG] = { |
| 16989 | .mixers = { alc861vd_3st_mixer }, |
| 16990 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16991 | alc861vd_3stack_init_verbs }, |
| 16992 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16993 | .dac_nids = alc660vd_dac_nids, |
| 16994 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16995 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16996 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16997 | .input_mux = &alc861vd_capture_source, |
| 16998 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16999 | [ALC861VD_3ST] = { |
| 17000 | .mixers = { alc861vd_3st_mixer }, |
| 17001 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17002 | alc861vd_3stack_init_verbs }, |
| 17003 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17004 | .dac_nids = alc861vd_dac_nids, |
| 17005 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17006 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17007 | .input_mux = &alc861vd_capture_source, |
| 17008 | }, |
| 17009 | [ALC861VD_3ST_DIG] = { |
| 17010 | .mixers = { alc861vd_3st_mixer }, |
| 17011 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17012 | alc861vd_3stack_init_verbs }, |
| 17013 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17014 | .dac_nids = alc861vd_dac_nids, |
| 17015 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17016 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17017 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17018 | .input_mux = &alc861vd_capture_source, |
| 17019 | }, |
| 17020 | [ALC861VD_6ST_DIG] = { |
| 17021 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 17022 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17023 | alc861vd_6stack_init_verbs }, |
| 17024 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17025 | .dac_nids = alc861vd_dac_nids, |
| 17026 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17027 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 17028 | .channel_mode = alc861vd_6stack_modes, |
| 17029 | .input_mux = &alc861vd_capture_source, |
| 17030 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17031 | [ALC861VD_LENOVO] = { |
| 17032 | .mixers = { alc861vd_lenovo_mixer }, |
| 17033 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17034 | alc861vd_3stack_init_verbs, |
| 17035 | alc861vd_eapd_verbs, |
| 17036 | alc861vd_lenovo_unsol_verbs }, |
| 17037 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17038 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17039 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17040 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17041 | .input_mux = &alc861vd_capture_source, |
| 17042 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17043 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17044 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17045 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17046 | [ALC861VD_DALLAS] = { |
| 17047 | .mixers = { alc861vd_dallas_mixer }, |
| 17048 | .init_verbs = { alc861vd_dallas_verbs }, |
| 17049 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17050 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17051 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17052 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17053 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17054 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17055 | .setup = alc861vd_dallas_setup, |
| 17056 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17057 | }, |
| 17058 | [ALC861VD_HP] = { |
| 17059 | .mixers = { alc861vd_hp_mixer }, |
| 17060 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 17061 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17062 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17063 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17064 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17065 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17066 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17067 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17068 | .setup = alc861vd_dallas_setup, |
| 17069 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17070 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17071 | [ALC660VD_ASUS_V1S] = { |
| 17072 | .mixers = { alc861vd_lenovo_mixer }, |
| 17073 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17074 | alc861vd_3stack_init_verbs, |
| 17075 | alc861vd_eapd_verbs, |
| 17076 | alc861vd_lenovo_unsol_verbs }, |
| 17077 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17078 | .dac_nids = alc660vd_dac_nids, |
| 17079 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17080 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17081 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17082 | .input_mux = &alc861vd_capture_source, |
| 17083 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17084 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17085 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17086 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17087 | }; |
| 17088 | |
| 17089 | /* |
| 17090 | * BIOS auto configuration |
| 17091 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17092 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 17093 | const struct auto_pin_cfg *cfg) |
| 17094 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 17095 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17096 | } |
| 17097 | |
| 17098 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17099 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17100 | hda_nid_t nid, int pin_type, int dac_idx) |
| 17101 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17102 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17103 | } |
| 17104 | |
| 17105 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 17106 | { |
| 17107 | struct alc_spec *spec = codec->spec; |
| 17108 | int i; |
| 17109 | |
| 17110 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17111 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17112 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17113 | if (nid) |
| 17114 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17115 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17116 | } |
| 17117 | } |
| 17118 | |
| 17119 | |
| 17120 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 17121 | { |
| 17122 | struct alc_spec *spec = codec->spec; |
| 17123 | hda_nid_t pin; |
| 17124 | |
| 17125 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17126 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17127 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17128 | pin = spec->autocfg.speaker_pins[0]; |
| 17129 | if (pin) |
| 17130 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17131 | } |
| 17132 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17133 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 17134 | |
| 17135 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 17136 | { |
| 17137 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17138 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17139 | int i; |
| 17140 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17141 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17142 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17143 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17144 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17145 | if (nid != ALC861VD_PIN_CD_NID && |
| 17146 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17147 | snd_hda_codec_write(codec, nid, 0, |
| 17148 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17149 | AMP_OUT_MUTE); |
| 17150 | } |
| 17151 | } |
| 17152 | } |
| 17153 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17154 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17155 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17156 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17157 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17158 | |
| 17159 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 17160 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17161 | * different NIDs for mute/unmute switch and volume control */ |
| 17162 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17163 | const struct auto_pin_cfg *cfg) |
| 17164 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 17165 | static const char * const chname[4] = { |
| 17166 | "Front", "Surround", "CLFE", "Side" |
| 17167 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17168 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17169 | hda_nid_t nid_v, nid_s; |
| 17170 | int i, err; |
| 17171 | |
| 17172 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17173 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17174 | continue; |
| 17175 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17176 | alc880_dac_to_idx( |
| 17177 | spec->multiout.dac_nids[i])); |
| 17178 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17179 | alc880_dac_to_idx( |
| 17180 | spec->multiout.dac_nids[i])); |
| 17181 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17182 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17183 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17184 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17185 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17186 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17187 | HDA_OUTPUT)); |
| 17188 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17189 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17190 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17191 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17192 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17193 | HDA_OUTPUT)); |
| 17194 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17195 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17196 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17197 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17198 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17199 | HDA_INPUT)); |
| 17200 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17201 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17202 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17203 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17204 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17205 | HDA_INPUT)); |
| 17206 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17207 | return err; |
| 17208 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17209 | const char *name = pfx; |
| 17210 | if (!name) |
| 17211 | name = chname[i]; |
| 17212 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17213 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17214 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17215 | HDA_OUTPUT)); |
| 17216 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17217 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17218 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17219 | name, i, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17220 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17221 | HDA_INPUT)); |
| 17222 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17223 | return err; |
| 17224 | } |
| 17225 | } |
| 17226 | return 0; |
| 17227 | } |
| 17228 | |
| 17229 | /* add playback controls for speaker and HP outputs */ |
| 17230 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17231 | * different NIDs for mute/unmute switch and volume control */ |
| 17232 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17233 | hda_nid_t pin, const char *pfx) |
| 17234 | { |
| 17235 | hda_nid_t nid_v, nid_s; |
| 17236 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17237 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17238 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17239 | return 0; |
| 17240 | |
| 17241 | if (alc880_is_fixed_pin(pin)) { |
| 17242 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17243 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17244 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17245 | spec->multiout.hp_nid = nid_v; |
| 17246 | else |
| 17247 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17248 | /* control HP volume/switch on the output mixer amp */ |
| 17249 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17250 | alc880_fixed_pin_idx(pin)); |
| 17251 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17252 | alc880_fixed_pin_idx(pin)); |
| 17253 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17254 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17255 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17256 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17257 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17258 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17259 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17260 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17261 | return err; |
| 17262 | } else if (alc880_is_multi_pin(pin)) { |
| 17263 | /* set manual connection */ |
| 17264 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17265 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17266 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17267 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17268 | return err; |
| 17269 | } |
| 17270 | return 0; |
| 17271 | } |
| 17272 | |
| 17273 | /* parse the BIOS configuration and set up the alc_spec |
| 17274 | * return 1 if successful, 0 if the proper config is not found, |
| 17275 | * or a negative error code |
| 17276 | * Based on ALC880 version - had to change it to override |
| 17277 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17278 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17279 | { |
| 17280 | struct alc_spec *spec = codec->spec; |
| 17281 | int err; |
| 17282 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17283 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17284 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17285 | alc861vd_ignore); |
| 17286 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17287 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17288 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17289 | return 0; /* can't find valid BIOS pin config */ |
| 17290 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17291 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17292 | if (err < 0) |
| 17293 | return err; |
| 17294 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17295 | if (err < 0) |
| 17296 | return err; |
| 17297 | err = alc861vd_auto_create_extra_out(spec, |
| 17298 | spec->autocfg.speaker_pins[0], |
| 17299 | "Speaker"); |
| 17300 | if (err < 0) |
| 17301 | return err; |
| 17302 | err = alc861vd_auto_create_extra_out(spec, |
| 17303 | spec->autocfg.hp_pins[0], |
| 17304 | "Headphone"); |
| 17305 | if (err < 0) |
| 17306 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17307 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17308 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17309 | return err; |
| 17310 | |
| 17311 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17312 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17313 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17314 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17315 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17316 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17317 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17318 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17319 | |
| 17320 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17321 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17322 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17323 | err = alc_auto_add_mic_boost(codec); |
| 17324 | if (err < 0) |
| 17325 | return err; |
| 17326 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17327 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17328 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17329 | return 1; |
| 17330 | } |
| 17331 | |
| 17332 | /* additional initialization for auto-configuration model */ |
| 17333 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17334 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17335 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17336 | alc861vd_auto_init_multi_out(codec); |
| 17337 | alc861vd_auto_init_hp_out(codec); |
| 17338 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17339 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17340 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17341 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17342 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17343 | } |
| 17344 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17345 | enum { |
| 17346 | ALC660VD_FIX_ASUS_GPIO1 |
| 17347 | }; |
| 17348 | |
| 17349 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17350 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17351 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17352 | .type = ALC_FIXUP_VERBS, |
| 17353 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17354 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17355 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17356 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17357 | { } |
| 17358 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17359 | }, |
| 17360 | }; |
| 17361 | |
| 17362 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17363 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17364 | {} |
| 17365 | }; |
| 17366 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17367 | static int patch_alc861vd(struct hda_codec *codec) |
| 17368 | { |
| 17369 | struct alc_spec *spec; |
| 17370 | int err, board_config; |
| 17371 | |
| 17372 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17373 | if (spec == NULL) |
| 17374 | return -ENOMEM; |
| 17375 | |
| 17376 | codec->spec = spec; |
| 17377 | |
| 17378 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17379 | alc861vd_models, |
| 17380 | alc861vd_cfg_tbl); |
| 17381 | |
| 17382 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17383 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17384 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17385 | board_config = ALC861VD_AUTO; |
| 17386 | } |
| 17387 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17388 | if (board_config == ALC861VD_AUTO) { |
| 17389 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17390 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17391 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17392 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17393 | if (board_config == ALC861VD_AUTO) { |
| 17394 | /* automatic parse from the BIOS config */ |
| 17395 | err = alc861vd_parse_auto_config(codec); |
| 17396 | if (err < 0) { |
| 17397 | alc_free(codec); |
| 17398 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17399 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17400 | printk(KERN_INFO |
| 17401 | "hda_codec: Cannot set up configuration " |
| 17402 | "from BIOS. Using base mode...\n"); |
| 17403 | board_config = ALC861VD_3ST; |
| 17404 | } |
| 17405 | } |
| 17406 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17407 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17408 | if (err < 0) { |
| 17409 | alc_free(codec); |
| 17410 | return err; |
| 17411 | } |
| 17412 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17413 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17414 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17415 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17416 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17417 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17418 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17419 | } |
| 17420 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17421 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17422 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17423 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17424 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17425 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17426 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17427 | if (!spec->adc_nids) { |
| 17428 | spec->adc_nids = alc861vd_adc_nids; |
| 17429 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17430 | } |
| 17431 | if (!spec->capsrc_nids) |
| 17432 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17433 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17434 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17435 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17436 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17437 | spec->vmaster_nid = 0x02; |
| 17438 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17439 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17440 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17441 | codec->patch_ops = alc_patch_ops; |
| 17442 | |
| 17443 | if (board_config == ALC861VD_AUTO) |
| 17444 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17445 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17446 | if (!spec->loopback.amplist) |
| 17447 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17448 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17449 | |
| 17450 | return 0; |
| 17451 | } |
| 17452 | |
| 17453 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17454 | * ALC662 support |
| 17455 | * |
| 17456 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17457 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17458 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17459 | * 6-channel independent captures. |
| 17460 | * |
| 17461 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17462 | * driver yet). |
| 17463 | */ |
| 17464 | #define ALC662_DIGOUT_NID 0x06 |
| 17465 | #define ALC662_DIGIN_NID 0x0a |
| 17466 | |
| 17467 | static hda_nid_t alc662_dac_nids[4] = { |
| 17468 | /* front, rear, clfe, rear_surr */ |
| 17469 | 0x02, 0x03, 0x04 |
| 17470 | }; |
| 17471 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17472 | static hda_nid_t alc272_dac_nids[2] = { |
| 17473 | 0x02, 0x03 |
| 17474 | }; |
| 17475 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17476 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17477 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17478 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17479 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17480 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17481 | static hda_nid_t alc272_adc_nids[1] = { |
| 17482 | /* ADC1-2 */ |
| 17483 | 0x08, |
| 17484 | }; |
| 17485 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17486 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17487 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17488 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17489 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17490 | /* input MUX */ |
| 17491 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17492 | static struct hda_input_mux alc662_capture_source = { |
| 17493 | .num_items = 4, |
| 17494 | .items = { |
| 17495 | { "Mic", 0x0 }, |
| 17496 | { "Front Mic", 0x1 }, |
| 17497 | { "Line", 0x2 }, |
| 17498 | { "CD", 0x4 }, |
| 17499 | }, |
| 17500 | }; |
| 17501 | |
| 17502 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17503 | .num_items = 2, |
| 17504 | .items = { |
| 17505 | { "Mic", 0x1 }, |
| 17506 | { "Line", 0x2 }, |
| 17507 | }, |
| 17508 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17509 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17510 | static struct hda_input_mux alc663_capture_source = { |
| 17511 | .num_items = 3, |
| 17512 | .items = { |
| 17513 | { "Mic", 0x0 }, |
| 17514 | { "Front Mic", 0x1 }, |
| 17515 | { "Line", 0x2 }, |
| 17516 | }, |
| 17517 | }; |
| 17518 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17519 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17520 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17521 | .num_items = 16, |
| 17522 | .items = { |
| 17523 | { "Autoselect Mic", 0x0 }, |
| 17524 | { "Internal Mic", 0x1 }, |
| 17525 | { "In-0x02", 0x2 }, |
| 17526 | { "In-0x03", 0x3 }, |
| 17527 | { "In-0x04", 0x4 }, |
| 17528 | { "In-0x05", 0x5 }, |
| 17529 | { "In-0x06", 0x6 }, |
| 17530 | { "In-0x07", 0x7 }, |
| 17531 | { "In-0x08", 0x8 }, |
| 17532 | { "In-0x09", 0x9 }, |
| 17533 | { "In-0x0a", 0x0a }, |
| 17534 | { "In-0x0b", 0x0b }, |
| 17535 | { "In-0x0c", 0x0c }, |
| 17536 | { "In-0x0d", 0x0d }, |
| 17537 | { "In-0x0e", 0x0e }, |
| 17538 | { "In-0x0f", 0x0f }, |
| 17539 | }, |
| 17540 | }; |
| 17541 | #endif |
| 17542 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17543 | /* |
| 17544 | * 2ch mode |
| 17545 | */ |
| 17546 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17547 | { 2, NULL } |
| 17548 | }; |
| 17549 | |
| 17550 | /* |
| 17551 | * 2ch mode |
| 17552 | */ |
| 17553 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17554 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17555 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17556 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17557 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17558 | { } /* end */ |
| 17559 | }; |
| 17560 | |
| 17561 | /* |
| 17562 | * 6ch mode |
| 17563 | */ |
| 17564 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17565 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17566 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17567 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17568 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17569 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17570 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17571 | { } /* end */ |
| 17572 | }; |
| 17573 | |
| 17574 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17575 | { 2, alc662_3ST_ch2_init }, |
| 17576 | { 6, alc662_3ST_ch6_init }, |
| 17577 | }; |
| 17578 | |
| 17579 | /* |
| 17580 | * 2ch mode |
| 17581 | */ |
| 17582 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17583 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17584 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17585 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17586 | { } /* end */ |
| 17587 | }; |
| 17588 | |
| 17589 | /* |
| 17590 | * 6ch mode |
| 17591 | */ |
| 17592 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17593 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17594 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17595 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17596 | { } /* end */ |
| 17597 | }; |
| 17598 | |
| 17599 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17600 | { 2, alc662_sixstack_ch6_init }, |
| 17601 | { 6, alc662_sixstack_ch8_init }, |
| 17602 | }; |
| 17603 | |
| 17604 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17605 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17606 | */ |
| 17607 | |
| 17608 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17609 | /* output mixer control */ |
| 17610 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17611 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17612 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17613 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17614 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17615 | 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] | 17616 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17617 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17618 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17619 | |
| 17620 | /*Input mixer control */ |
| 17621 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17622 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17623 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17624 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17625 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17626 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17627 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17628 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17629 | { } /* end */ |
| 17630 | }; |
| 17631 | |
| 17632 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17634 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17635 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17636 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17637 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17638 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17639 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17640 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17641 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17642 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17643 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17644 | { } /* end */ |
| 17645 | }; |
| 17646 | |
| 17647 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17649 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17650 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17651 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17652 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17653 | 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] | 17654 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17655 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17656 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17657 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17658 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17659 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17660 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17661 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17662 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17663 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17664 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17665 | { } /* end */ |
| 17666 | }; |
| 17667 | |
| 17668 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17669 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17670 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17671 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17672 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17673 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17674 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17675 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17676 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17677 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17678 | { } /* end */ |
| 17679 | }; |
| 17680 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17681 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17682 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17683 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17684 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17685 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17686 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17687 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17688 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17689 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17690 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17691 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17692 | { } /* end */ |
| 17693 | }; |
| 17694 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17695 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17696 | ALC262_HIPPO_MASTER_SWITCH, |
| 17697 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17698 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17699 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17700 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17701 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17702 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17703 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17704 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17705 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17706 | { } /* end */ |
| 17707 | }; |
| 17708 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17709 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17710 | .ops = &snd_hda_bind_vol, |
| 17711 | .values = { |
| 17712 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17713 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17714 | 0 |
| 17715 | }, |
| 17716 | }; |
| 17717 | |
| 17718 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17719 | .ops = &snd_hda_bind_sw, |
| 17720 | .values = { |
| 17721 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17722 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17723 | 0 |
| 17724 | }, |
| 17725 | }; |
| 17726 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17727 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17728 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17729 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17730 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17731 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17732 | { } /* end */ |
| 17733 | }; |
| 17734 | |
| 17735 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17736 | .ops = &snd_hda_bind_sw, |
| 17737 | .values = { |
| 17738 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17739 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17740 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17741 | 0 |
| 17742 | }, |
| 17743 | }; |
| 17744 | |
| 17745 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17746 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17747 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17748 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17749 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17750 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17751 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17752 | |
| 17753 | { } /* end */ |
| 17754 | }; |
| 17755 | |
| 17756 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17757 | .ops = &snd_hda_bind_sw, |
| 17758 | .values = { |
| 17759 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17760 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17761 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17762 | 0 |
| 17763 | }, |
| 17764 | }; |
| 17765 | |
| 17766 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17767 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17768 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17769 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17770 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17771 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17772 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17773 | { } /* end */ |
| 17774 | }; |
| 17775 | |
| 17776 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17777 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17778 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17779 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17780 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17781 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17782 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17783 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17784 | { } /* end */ |
| 17785 | }; |
| 17786 | |
| 17787 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17788 | .ops = &snd_hda_bind_vol, |
| 17789 | .values = { |
| 17790 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17791 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17792 | 0 |
| 17793 | }, |
| 17794 | }; |
| 17795 | |
| 17796 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17797 | .ops = &snd_hda_bind_sw, |
| 17798 | .values = { |
| 17799 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17800 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17801 | 0 |
| 17802 | }, |
| 17803 | }; |
| 17804 | |
| 17805 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17806 | HDA_BIND_VOL("Master Playback Volume", |
| 17807 | &alc663_asus_two_bind_master_vol), |
| 17808 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17809 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17810 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17813 | { } /* end */ |
| 17814 | }; |
| 17815 | |
| 17816 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17817 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17818 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17819 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17820 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17821 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17822 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17823 | { } /* end */ |
| 17824 | }; |
| 17825 | |
| 17826 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17827 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17828 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17829 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17830 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17831 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17832 | |
| 17833 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17835 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17836 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17837 | { } /* end */ |
| 17838 | }; |
| 17839 | |
| 17840 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17841 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17842 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17843 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17844 | |
| 17845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17847 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17848 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17849 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17850 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17851 | { } /* end */ |
| 17852 | }; |
| 17853 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17854 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17855 | .ops = &snd_hda_bind_sw, |
| 17856 | .values = { |
| 17857 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17858 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17859 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17860 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17861 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17862 | 0 |
| 17863 | }, |
| 17864 | }; |
| 17865 | |
| 17866 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17867 | .ops = &snd_hda_bind_sw, |
| 17868 | .values = { |
| 17869 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17870 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17871 | 0 |
| 17872 | }, |
| 17873 | }; |
| 17874 | |
| 17875 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17876 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17877 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17878 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17879 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17880 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17881 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17882 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17883 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17884 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17885 | { } /* end */ |
| 17886 | }; |
| 17887 | |
| 17888 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17889 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17890 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17891 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17892 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17893 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17894 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17896 | { } /* end */ |
| 17897 | }; |
| 17898 | |
| 17899 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17900 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17901 | { |
| 17902 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17903 | .name = "Channel Mode", |
| 17904 | .info = alc_ch_mode_info, |
| 17905 | .get = alc_ch_mode_get, |
| 17906 | .put = alc_ch_mode_put, |
| 17907 | }, |
| 17908 | { } /* end */ |
| 17909 | }; |
| 17910 | |
| 17911 | static struct hda_verb alc662_init_verbs[] = { |
| 17912 | /* ADC: mute amp left and right */ |
| 17913 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17914 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17915 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17916 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17917 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17918 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17919 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17920 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17921 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17922 | |
| 17923 | /* Front Pin: output 0 (0x0c) */ |
| 17924 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17925 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17926 | |
| 17927 | /* Rear Pin: output 1 (0x0d) */ |
| 17928 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17929 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17930 | |
| 17931 | /* CLFE Pin: output 2 (0x0e) */ |
| 17932 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17933 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17934 | |
| 17935 | /* Mic (rear) pin: input vref at 80% */ |
| 17936 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17937 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17938 | /* Front Mic pin: input vref at 80% */ |
| 17939 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17940 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17941 | /* Line In pin: input */ |
| 17942 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17943 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17944 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17945 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17946 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17947 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17948 | /* CD pin widget for input */ |
| 17949 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17950 | |
| 17951 | /* FIXME: use matrix-type input source selection */ |
| 17952 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17953 | /* Input mixer */ |
| 17954 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17955 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17956 | |
| 17957 | /* always trun on EAPD */ |
| 17958 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17959 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17960 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17961 | { } |
| 17962 | }; |
| 17963 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17964 | static struct hda_verb alc663_init_verbs[] = { |
| 17965 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17966 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17967 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17968 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17969 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17970 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17971 | { } |
| 17972 | }; |
| 17973 | |
| 17974 | static struct hda_verb alc272_init_verbs[] = { |
| 17975 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17976 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17977 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17978 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17979 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17980 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17981 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17982 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17983 | { } |
| 17984 | }; |
| 17985 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17986 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17987 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17988 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17989 | {} |
| 17990 | }; |
| 17991 | |
| 17992 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17993 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17994 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17995 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17996 | }; |
| 17997 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17998 | /* Set Unsolicited Event*/ |
| 17999 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 18000 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18001 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18002 | {} |
| 18003 | }; |
| 18004 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18005 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18006 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18007 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18008 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18009 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18010 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18011 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18012 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18013 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18014 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18015 | {} |
| 18016 | }; |
| 18017 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18018 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 18019 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18020 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18021 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18022 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18023 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18024 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18025 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18026 | {} |
| 18027 | }; |
| 18028 | |
| 18029 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 18030 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18031 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18032 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18033 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18034 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18035 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18036 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18037 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18038 | {} |
| 18039 | }; |
| 18040 | |
| 18041 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 18042 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18043 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18044 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18045 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18047 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18048 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18049 | {} |
| 18050 | }; |
| 18051 | |
| 18052 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 18053 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18054 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18055 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18056 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18059 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18060 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18062 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18063 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18064 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18065 | {} |
| 18066 | }; |
| 18067 | |
| 18068 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 18069 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18070 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18071 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18072 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18073 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18074 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18075 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18076 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18077 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18078 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18079 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18080 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18081 | {} |
| 18082 | }; |
| 18083 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18084 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 18085 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18086 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 18087 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 18088 | |
| 18089 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18090 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18091 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18092 | |
| 18093 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 18094 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 18095 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 18096 | {} |
| 18097 | }; |
| 18098 | |
| 18099 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 18100 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18101 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18102 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18103 | |
| 18104 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18105 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18106 | {} |
| 18107 | }; |
| 18108 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18109 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 18110 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 18111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18112 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18113 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18114 | {} |
| 18115 | }; |
| 18116 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18117 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 18118 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18119 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18120 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18121 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18122 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18123 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18124 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18125 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18126 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18127 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18128 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18129 | {} |
| 18130 | }; |
| 18131 | |
| 18132 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 18133 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18134 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18135 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18136 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18137 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18138 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18139 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18140 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18141 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18142 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18143 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18144 | {} |
| 18145 | }; |
| 18146 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18147 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 18148 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18149 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18150 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18151 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18152 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18153 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18154 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18155 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18156 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18157 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18158 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18159 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18160 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18161 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18162 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18163 | {} |
| 18164 | }; |
| 18165 | |
| 18166 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 18167 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18168 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18169 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18170 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18171 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18172 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18173 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18174 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18175 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18176 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18177 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18180 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18181 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18182 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18183 | {} |
| 18184 | }; |
| 18185 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18186 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18187 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18188 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18189 | { } /* end */ |
| 18190 | }; |
| 18191 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18192 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18193 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18194 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18195 | { } /* end */ |
| 18196 | }; |
| 18197 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18198 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 18199 | { |
| 18200 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18201 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18202 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18203 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18204 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18205 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18206 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18207 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18208 | } |
| 18209 | |
| 18210 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 18211 | { |
| 18212 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18213 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18214 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18215 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18216 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18217 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18218 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18219 | HDA_AMP_MUTE, bits); |
| 18220 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18221 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18222 | } |
| 18223 | |
| 18224 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 18225 | unsigned int res) |
| 18226 | { |
| 18227 | if ((res >> 26) == ALC880_HP_EVENT) |
| 18228 | alc662_lenovo_101e_all_automute(codec); |
| 18229 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 18230 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 18231 | } |
| 18232 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18233 | /* unsolicited event for HP jack sensing */ |
| 18234 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 18235 | unsigned int res) |
| 18236 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18237 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18238 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18239 | else |
| 18240 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18241 | } |
| 18242 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18243 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18244 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18245 | struct alc_spec *spec = codec->spec; |
| 18246 | |
| 18247 | alc262_hippo1_setup(codec); |
| 18248 | spec->ext_mic.pin = 0x18; |
| 18249 | spec->ext_mic.mux_idx = 0; |
| 18250 | spec->int_mic.pin = 0x19; |
| 18251 | spec->int_mic.mux_idx = 1; |
| 18252 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18253 | } |
| 18254 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18255 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 18256 | { |
| 18257 | alc262_hippo_automute(codec); |
| 18258 | alc_mic_automute(codec); |
| 18259 | } |
| 18260 | |
| 18261 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18262 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18263 | struct alc_spec *spec = codec->spec; |
| 18264 | |
| 18265 | spec->autocfg.hp_pins[0] = 0x14; |
| 18266 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18267 | } |
| 18268 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18269 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 18270 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18271 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 18272 | { |
| 18273 | unsigned int present; |
| 18274 | unsigned char bits; |
| 18275 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18276 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18277 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18278 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18279 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18280 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18281 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18282 | } |
| 18283 | |
| 18284 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 18285 | { |
| 18286 | unsigned int present; |
| 18287 | unsigned char bits; |
| 18288 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18289 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18290 | bits = present ? HDA_AMP_MUTE : 0; |
| 18291 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18292 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18293 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18294 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18295 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18296 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18297 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18298 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18299 | } |
| 18300 | |
| 18301 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18302 | { |
| 18303 | unsigned int present; |
| 18304 | unsigned char bits; |
| 18305 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18306 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18307 | bits = present ? HDA_AMP_MUTE : 0; |
| 18308 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18309 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18310 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18311 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18312 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18313 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18314 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18315 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18316 | } |
| 18317 | |
| 18318 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18319 | { |
| 18320 | unsigned int present; |
| 18321 | unsigned char bits; |
| 18322 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18323 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18324 | bits = present ? 0 : PIN_OUT; |
| 18325 | snd_hda_codec_write(codec, 0x14, 0, |
| 18326 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18327 | } |
| 18328 | |
| 18329 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18330 | { |
| 18331 | unsigned int present1, present2; |
| 18332 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18333 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18334 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18335 | |
| 18336 | if (present1 || present2) { |
| 18337 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18338 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18339 | } else { |
| 18340 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18341 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18342 | } |
| 18343 | } |
| 18344 | |
| 18345 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18346 | { |
| 18347 | unsigned int present1, present2; |
| 18348 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18349 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18350 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18351 | |
| 18352 | if (present1 || present2) { |
| 18353 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18354 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18355 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18356 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18357 | } else { |
| 18358 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18359 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18360 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18361 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18362 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18363 | } |
| 18364 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18365 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18366 | { |
| 18367 | unsigned int present1, present2; |
| 18368 | |
| 18369 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18370 | AC_VERB_GET_PIN_SENSE, 0) |
| 18371 | & AC_PINSENSE_PRESENCE; |
| 18372 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18373 | AC_VERB_GET_PIN_SENSE, 0) |
| 18374 | & AC_PINSENSE_PRESENCE; |
| 18375 | |
| 18376 | if (present1 || present2) { |
| 18377 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18378 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18379 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18380 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18381 | } else { |
| 18382 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18383 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18384 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18385 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18386 | } |
| 18387 | } |
| 18388 | |
| 18389 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18390 | { |
| 18391 | unsigned int present1, present2; |
| 18392 | |
| 18393 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18394 | AC_VERB_GET_PIN_SENSE, 0) |
| 18395 | & AC_PINSENSE_PRESENCE; |
| 18396 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18397 | AC_VERB_GET_PIN_SENSE, 0) |
| 18398 | & AC_PINSENSE_PRESENCE; |
| 18399 | |
| 18400 | if (present1 || present2) { |
| 18401 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18402 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18403 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18404 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18405 | } else { |
| 18406 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18407 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18408 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18409 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18410 | } |
| 18411 | } |
| 18412 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18413 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18414 | unsigned int res) |
| 18415 | { |
| 18416 | switch (res >> 26) { |
| 18417 | case ALC880_HP_EVENT: |
| 18418 | alc663_m51va_speaker_automute(codec); |
| 18419 | break; |
| 18420 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18421 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18422 | break; |
| 18423 | } |
| 18424 | } |
| 18425 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18426 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18427 | { |
| 18428 | struct alc_spec *spec = codec->spec; |
| 18429 | spec->ext_mic.pin = 0x18; |
| 18430 | spec->ext_mic.mux_idx = 0; |
| 18431 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18432 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18433 | spec->auto_mic = 1; |
| 18434 | } |
| 18435 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18436 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18437 | { |
| 18438 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18439 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18440 | } |
| 18441 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18442 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18443 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18444 | |
| 18445 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18446 | { |
| 18447 | struct alc_spec *spec = codec->spec; |
| 18448 | spec->ext_mic.pin = 0x18; |
| 18449 | spec->ext_mic.mux_idx = 0; |
| 18450 | spec->int_mic.pin = 0x19; |
| 18451 | spec->int_mic.mux_idx = 1; |
| 18452 | spec->auto_mic = 1; |
| 18453 | } |
| 18454 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18455 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18456 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18457 | /* ***************** Mode2 ******************************/ |
| 18458 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18459 | unsigned int res) |
| 18460 | { |
| 18461 | switch (res >> 26) { |
| 18462 | case ALC880_HP_EVENT: |
| 18463 | alc662_f5z_speaker_automute(codec); |
| 18464 | break; |
| 18465 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18466 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18467 | break; |
| 18468 | } |
| 18469 | } |
| 18470 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18471 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18472 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18473 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18474 | { |
| 18475 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18476 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18477 | } |
| 18478 | /* ***************** Mode3 ******************************/ |
| 18479 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18480 | unsigned int res) |
| 18481 | { |
| 18482 | switch (res >> 26) { |
| 18483 | case ALC880_HP_EVENT: |
| 18484 | alc663_two_hp_m1_speaker_automute(codec); |
| 18485 | break; |
| 18486 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18487 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18488 | break; |
| 18489 | } |
| 18490 | } |
| 18491 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18492 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18493 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18494 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18495 | { |
| 18496 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18497 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18498 | } |
| 18499 | /* ***************** Mode4 ******************************/ |
| 18500 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18501 | unsigned int res) |
| 18502 | { |
| 18503 | switch (res >> 26) { |
| 18504 | case ALC880_HP_EVENT: |
| 18505 | alc663_21jd_two_speaker_automute(codec); |
| 18506 | break; |
| 18507 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18508 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18509 | break; |
| 18510 | } |
| 18511 | } |
| 18512 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18513 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18514 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18515 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18516 | { |
| 18517 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18518 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18519 | } |
| 18520 | /* ***************** Mode5 ******************************/ |
| 18521 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18522 | unsigned int res) |
| 18523 | { |
| 18524 | switch (res >> 26) { |
| 18525 | case ALC880_HP_EVENT: |
| 18526 | alc663_15jd_two_speaker_automute(codec); |
| 18527 | break; |
| 18528 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18529 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18530 | break; |
| 18531 | } |
| 18532 | } |
| 18533 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18534 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18535 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18536 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18537 | { |
| 18538 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18539 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18540 | } |
| 18541 | /* ***************** Mode6 ******************************/ |
| 18542 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18543 | unsigned int res) |
| 18544 | { |
| 18545 | switch (res >> 26) { |
| 18546 | case ALC880_HP_EVENT: |
| 18547 | alc663_two_hp_m2_speaker_automute(codec); |
| 18548 | break; |
| 18549 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18550 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18551 | break; |
| 18552 | } |
| 18553 | } |
| 18554 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18555 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18556 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18557 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18558 | { |
| 18559 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18560 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18561 | } |
| 18562 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18563 | /* ***************** Mode7 ******************************/ |
| 18564 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18565 | unsigned int res) |
| 18566 | { |
| 18567 | switch (res >> 26) { |
| 18568 | case ALC880_HP_EVENT: |
| 18569 | alc663_two_hp_m7_speaker_automute(codec); |
| 18570 | break; |
| 18571 | case ALC880_MIC_EVENT: |
| 18572 | alc_mic_automute(codec); |
| 18573 | break; |
| 18574 | } |
| 18575 | } |
| 18576 | |
| 18577 | #define alc663_mode7_setup alc663_mode1_setup |
| 18578 | |
| 18579 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18580 | { |
| 18581 | alc663_two_hp_m7_speaker_automute(codec); |
| 18582 | alc_mic_automute(codec); |
| 18583 | } |
| 18584 | |
| 18585 | /* ***************** Mode8 ******************************/ |
| 18586 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18587 | unsigned int res) |
| 18588 | { |
| 18589 | switch (res >> 26) { |
| 18590 | case ALC880_HP_EVENT: |
| 18591 | alc663_two_hp_m8_speaker_automute(codec); |
| 18592 | break; |
| 18593 | case ALC880_MIC_EVENT: |
| 18594 | alc_mic_automute(codec); |
| 18595 | break; |
| 18596 | } |
| 18597 | } |
| 18598 | |
| 18599 | #define alc663_mode8_setup alc663_m51va_setup |
| 18600 | |
| 18601 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18602 | { |
| 18603 | alc663_two_hp_m8_speaker_automute(codec); |
| 18604 | alc_mic_automute(codec); |
| 18605 | } |
| 18606 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18607 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18608 | { |
| 18609 | unsigned int present; |
| 18610 | unsigned char bits; |
| 18611 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18612 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18613 | bits = present ? HDA_AMP_MUTE : 0; |
| 18614 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18615 | HDA_AMP_MUTE, bits); |
| 18616 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18617 | HDA_AMP_MUTE, bits); |
| 18618 | } |
| 18619 | |
| 18620 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18621 | { |
| 18622 | unsigned int present; |
| 18623 | unsigned char bits; |
| 18624 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18625 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18626 | bits = present ? HDA_AMP_MUTE : 0; |
| 18627 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18628 | HDA_AMP_MUTE, bits); |
| 18629 | } |
| 18630 | |
| 18631 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18632 | unsigned int res) |
| 18633 | { |
| 18634 | switch (res >> 26) { |
| 18635 | case ALC880_HP_EVENT: |
| 18636 | alc663_g71v_hp_automute(codec); |
| 18637 | break; |
| 18638 | case ALC880_FRONT_EVENT: |
| 18639 | alc663_g71v_front_automute(codec); |
| 18640 | break; |
| 18641 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18642 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18643 | break; |
| 18644 | } |
| 18645 | } |
| 18646 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18647 | #define alc663_g71v_setup alc663_m51va_setup |
| 18648 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18649 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18650 | { |
| 18651 | alc663_g71v_front_automute(codec); |
| 18652 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18653 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18654 | } |
| 18655 | |
| 18656 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18657 | unsigned int res) |
| 18658 | { |
| 18659 | switch (res >> 26) { |
| 18660 | case ALC880_HP_EVENT: |
| 18661 | alc663_m51va_speaker_automute(codec); |
| 18662 | break; |
| 18663 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18664 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18665 | break; |
| 18666 | } |
| 18667 | } |
| 18668 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18669 | #define alc663_g50v_setup alc663_m51va_setup |
| 18670 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18671 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18672 | { |
| 18673 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18674 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18675 | } |
| 18676 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18677 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18678 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18679 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18680 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18681 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18682 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18683 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18684 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18685 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18686 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18687 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18688 | { } /* end */ |
| 18689 | }; |
| 18690 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18691 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18692 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18693 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18694 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18695 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18697 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18698 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18699 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18700 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18701 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18702 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18703 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18704 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18705 | { } /* end */ |
| 18706 | }; |
| 18707 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18708 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18709 | #define alc662_loopbacks alc880_loopbacks |
| 18710 | #endif |
| 18711 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18712 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18713 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18714 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18715 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18716 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18717 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18718 | |
| 18719 | /* |
| 18720 | * configuration and preset |
| 18721 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18722 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18723 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18724 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18725 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18726 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18727 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18728 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18729 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18730 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18731 | [ALC663_ASUS_M51VA] = "m51va", |
| 18732 | [ALC663_ASUS_G71V] = "g71v", |
| 18733 | [ALC663_ASUS_H13] = "h13", |
| 18734 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18735 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18736 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18737 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18738 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18739 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18740 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18741 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18742 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18743 | [ALC272_DELL] = "dell", |
| 18744 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18745 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18746 | [ALC662_AUTO] = "auto", |
| 18747 | }; |
| 18748 | |
| 18749 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18750 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18751 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18752 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18753 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18754 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18755 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18756 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18757 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18758 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18759 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18760 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18761 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18762 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18763 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18764 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18765 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18766 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18767 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18768 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18769 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18770 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18771 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18772 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18773 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18774 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18775 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18776 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18777 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18778 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18779 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18780 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18781 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18782 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18783 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18784 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18785 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18786 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18787 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18788 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18789 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18790 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18791 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18792 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18793 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18794 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18795 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18796 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18797 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18798 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18799 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18800 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18801 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18802 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18803 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18804 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18805 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18806 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18807 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18808 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18809 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18810 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18811 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18812 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18813 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18814 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18815 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18816 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18817 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18818 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18819 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18820 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18821 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18822 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18823 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18824 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18825 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18826 | ALC663_ASUS_H13), |
Anisse Astier | 965b76d | 2011-02-10 13:14:44 +0100 | [diff] [blame] | 18827 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18828 | {} |
| 18829 | }; |
| 18830 | |
| 18831 | static struct alc_config_preset alc662_presets[] = { |
| 18832 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18833 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18834 | .init_verbs = { alc662_init_verbs }, |
| 18835 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18836 | .dac_nids = alc662_dac_nids, |
| 18837 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18838 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18839 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18840 | .channel_mode = alc662_3ST_2ch_modes, |
| 18841 | .input_mux = &alc662_capture_source, |
| 18842 | }, |
| 18843 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18844 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18845 | .init_verbs = { alc662_init_verbs }, |
| 18846 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18847 | .dac_nids = alc662_dac_nids, |
| 18848 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18849 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18850 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18851 | .channel_mode = alc662_3ST_6ch_modes, |
| 18852 | .need_dac_fix = 1, |
| 18853 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18854 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18855 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18856 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18857 | .init_verbs = { alc662_init_verbs }, |
| 18858 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18859 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18860 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18861 | .channel_mode = alc662_3ST_6ch_modes, |
| 18862 | .need_dac_fix = 1, |
| 18863 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18864 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18865 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18866 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18867 | .init_verbs = { alc662_init_verbs }, |
| 18868 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18869 | .dac_nids = alc662_dac_nids, |
| 18870 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18871 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18872 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18873 | .channel_mode = alc662_5stack_modes, |
| 18874 | .input_mux = &alc662_capture_source, |
| 18875 | }, |
| 18876 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18877 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18878 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18879 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18880 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18881 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18882 | .channel_mode = alc662_3ST_2ch_modes, |
| 18883 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18884 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18885 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18886 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18887 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18888 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18889 | .init_verbs = { alc662_init_verbs, |
| 18890 | alc662_eeepc_sue_init_verbs }, |
| 18891 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18892 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18893 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18894 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18895 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18896 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18897 | .init_hook = alc662_eeepc_inithook, |
| 18898 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18899 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18900 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18901 | alc662_chmode_mixer }, |
| 18902 | .init_verbs = { alc662_init_verbs, |
| 18903 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18904 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18905 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18906 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18907 | .channel_mode = alc662_3ST_6ch_modes, |
| 18908 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18909 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18910 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18911 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18912 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18913 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18914 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18915 | .init_verbs = { alc662_init_verbs, |
| 18916 | alc662_ecs_init_verbs }, |
| 18917 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18918 | .dac_nids = alc662_dac_nids, |
| 18919 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18920 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18921 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18922 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18923 | .init_hook = alc662_eeepc_inithook, |
| 18924 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18925 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18926 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18927 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18928 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18929 | .dac_nids = alc662_dac_nids, |
| 18930 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18931 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18932 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18933 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18934 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18935 | .init_hook = alc663_m51va_inithook, |
| 18936 | }, |
| 18937 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18938 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18939 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18940 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18941 | .dac_nids = alc662_dac_nids, |
| 18942 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18943 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18944 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18945 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18946 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18947 | .init_hook = alc663_g71v_inithook, |
| 18948 | }, |
| 18949 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18950 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18951 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18952 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18953 | .dac_nids = alc662_dac_nids, |
| 18954 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18955 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18956 | .unsol_event = alc663_m51va_unsol_event, |
| 18957 | .init_hook = alc663_m51va_inithook, |
| 18958 | }, |
| 18959 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18960 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18961 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18962 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18963 | .dac_nids = alc662_dac_nids, |
| 18964 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18965 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18966 | .channel_mode = alc662_3ST_6ch_modes, |
| 18967 | .input_mux = &alc663_capture_source, |
| 18968 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18969 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18970 | .init_hook = alc663_g50v_inithook, |
| 18971 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18972 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18973 | .mixers = { alc663_m51va_mixer }, |
| 18974 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18975 | .init_verbs = { alc662_init_verbs, |
| 18976 | alc663_21jd_amic_init_verbs }, |
| 18977 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18978 | .hp_nid = 0x03, |
| 18979 | .dac_nids = alc662_dac_nids, |
| 18980 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18981 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18982 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18983 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18984 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18985 | .init_hook = alc663_mode1_inithook, |
| 18986 | }, |
| 18987 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18988 | .mixers = { alc662_1bjd_mixer }, |
| 18989 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18990 | .init_verbs = { alc662_init_verbs, |
| 18991 | alc662_1bjd_amic_init_verbs }, |
| 18992 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18993 | .dac_nids = alc662_dac_nids, |
| 18994 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18995 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18996 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18997 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18998 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18999 | .init_hook = alc662_mode2_inithook, |
| 19000 | }, |
| 19001 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19002 | .mixers = { alc663_two_hp_m1_mixer }, |
| 19003 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19004 | .init_verbs = { alc662_init_verbs, |
| 19005 | alc663_two_hp_amic_m1_init_verbs }, |
| 19006 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19007 | .hp_nid = 0x03, |
| 19008 | .dac_nids = alc662_dac_nids, |
| 19009 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19010 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19011 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19012 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19013 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19014 | .init_hook = alc663_mode3_inithook, |
| 19015 | }, |
| 19016 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19017 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 19018 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19019 | .init_verbs = { alc662_init_verbs, |
| 19020 | alc663_21jd_amic_init_verbs}, |
| 19021 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19022 | .hp_nid = 0x03, |
| 19023 | .dac_nids = alc662_dac_nids, |
| 19024 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19025 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19026 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19027 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19028 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19029 | .init_hook = alc663_mode4_inithook, |
| 19030 | }, |
| 19031 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19032 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 19033 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19034 | .init_verbs = { alc662_init_verbs, |
| 19035 | alc663_15jd_amic_init_verbs }, |
| 19036 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19037 | .hp_nid = 0x03, |
| 19038 | .dac_nids = alc662_dac_nids, |
| 19039 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19040 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19041 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19042 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19043 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19044 | .init_hook = alc663_mode5_inithook, |
| 19045 | }, |
| 19046 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19047 | .mixers = { alc663_two_hp_m2_mixer }, |
| 19048 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19049 | .init_verbs = { alc662_init_verbs, |
| 19050 | alc663_two_hp_amic_m2_init_verbs }, |
| 19051 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19052 | .hp_nid = 0x03, |
| 19053 | .dac_nids = alc662_dac_nids, |
| 19054 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19055 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19056 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19057 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19058 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19059 | .init_hook = alc663_mode6_inithook, |
| 19060 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19061 | [ALC663_ASUS_MODE7] = { |
| 19062 | .mixers = { alc663_mode7_mixer }, |
| 19063 | .cap_mixer = alc662_auto_capture_mixer, |
| 19064 | .init_verbs = { alc662_init_verbs, |
| 19065 | alc663_mode7_init_verbs }, |
| 19066 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19067 | .hp_nid = 0x03, |
| 19068 | .dac_nids = alc662_dac_nids, |
| 19069 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19070 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19071 | .channel_mode = alc662_3ST_2ch_modes, |
| 19072 | .unsol_event = alc663_mode7_unsol_event, |
| 19073 | .setup = alc663_mode7_setup, |
| 19074 | .init_hook = alc663_mode7_inithook, |
| 19075 | }, |
| 19076 | [ALC663_ASUS_MODE8] = { |
| 19077 | .mixers = { alc663_mode8_mixer }, |
| 19078 | .cap_mixer = alc662_auto_capture_mixer, |
| 19079 | .init_verbs = { alc662_init_verbs, |
| 19080 | alc663_mode8_init_verbs }, |
| 19081 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19082 | .hp_nid = 0x03, |
| 19083 | .dac_nids = alc662_dac_nids, |
| 19084 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19085 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19086 | .channel_mode = alc662_3ST_2ch_modes, |
| 19087 | .unsol_event = alc663_mode8_unsol_event, |
| 19088 | .setup = alc663_mode8_setup, |
| 19089 | .init_hook = alc663_mode8_inithook, |
| 19090 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19091 | [ALC272_DELL] = { |
| 19092 | .mixers = { alc663_m51va_mixer }, |
| 19093 | .cap_mixer = alc272_auto_capture_mixer, |
| 19094 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 19095 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19096 | .dac_nids = alc662_dac_nids, |
| 19097 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19098 | .adc_nids = alc272_adc_nids, |
| 19099 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 19100 | .capsrc_nids = alc272_capsrc_nids, |
| 19101 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19102 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19103 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19104 | .init_hook = alc663_m51va_inithook, |
| 19105 | }, |
| 19106 | [ALC272_DELL_ZM1] = { |
| 19107 | .mixers = { alc663_m51va_mixer }, |
| 19108 | .cap_mixer = alc662_auto_capture_mixer, |
| 19109 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 19110 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19111 | .dac_nids = alc662_dac_nids, |
| 19112 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19113 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19114 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19115 | .capsrc_nids = alc662_capsrc_nids, |
| 19116 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19117 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19118 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19119 | .init_hook = alc663_m51va_inithook, |
| 19120 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19121 | [ALC272_SAMSUNG_NC10] = { |
| 19122 | .mixers = { alc272_nc10_mixer }, |
| 19123 | .init_verbs = { alc662_init_verbs, |
| 19124 | alc663_21jd_amic_init_verbs }, |
| 19125 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19126 | .dac_nids = alc272_dac_nids, |
| 19127 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19128 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19129 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19130 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19131 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19132 | .init_hook = alc663_mode4_inithook, |
| 19133 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19134 | }; |
| 19135 | |
| 19136 | |
| 19137 | /* |
| 19138 | * BIOS auto configuration |
| 19139 | */ |
| 19140 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19141 | /* convert from MIX nid to DAC */ |
| 19142 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 19143 | { |
| 19144 | if (nid == 0x0f) |
| 19145 | return 0x02; |
| 19146 | else if (nid >= 0x0c && nid <= 0x0e) |
| 19147 | return nid - 0x0c + 0x02; |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19148 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ |
| 19149 | return 0x25; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19150 | else |
| 19151 | return 0; |
| 19152 | } |
| 19153 | |
| 19154 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 19155 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 19156 | hda_nid_t dac) |
| 19157 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19158 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19159 | int i, num; |
| 19160 | |
| 19161 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 19162 | for (i = 0; i < num; i++) { |
| 19163 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 19164 | return mix[i]; |
| 19165 | } |
| 19166 | return 0; |
| 19167 | } |
| 19168 | |
| 19169 | /* look for an empty DAC slot */ |
| 19170 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 19171 | { |
| 19172 | struct alc_spec *spec = codec->spec; |
| 19173 | hda_nid_t srcs[5]; |
| 19174 | int i, j, num; |
| 19175 | |
| 19176 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 19177 | if (num < 0) |
| 19178 | return 0; |
| 19179 | for (i = 0; i < num; i++) { |
| 19180 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 19181 | if (!nid) |
| 19182 | continue; |
| 19183 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 19184 | if (spec->multiout.dac_nids[j] == nid) |
| 19185 | break; |
| 19186 | if (j >= spec->multiout.num_dacs) |
| 19187 | return nid; |
| 19188 | } |
| 19189 | return 0; |
| 19190 | } |
| 19191 | |
| 19192 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 19193 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 19194 | const struct auto_pin_cfg *cfg) |
| 19195 | { |
| 19196 | struct alc_spec *spec = codec->spec; |
| 19197 | int i; |
| 19198 | hda_nid_t dac; |
| 19199 | |
| 19200 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19201 | for (i = 0; i < cfg->line_outs; i++) { |
| 19202 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 19203 | if (!dac) |
| 19204 | continue; |
| 19205 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19206 | } |
| 19207 | return 0; |
| 19208 | } |
| 19209 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19210 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 19211 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19212 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19213 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19214 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 19215 | } |
| 19216 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19217 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 19218 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19219 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19220 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19221 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19222 | } |
| 19223 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19224 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 19225 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 19226 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 19227 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19228 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19229 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19230 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19231 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19232 | |
| 19233 | /* add playback controls from the parsed DAC table */ |
| 19234 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19235 | const struct auto_pin_cfg *cfg) |
| 19236 | { |
| 19237 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19238 | static const char * const chname[4] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19239 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19240 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19241 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19242 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19243 | int i, err; |
| 19244 | |
| 19245 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19246 | nid = spec->multiout.dac_nids[i]; |
| 19247 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19248 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19249 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 19250 | if (!mix) |
| 19251 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19252 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19253 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19254 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19255 | if (err < 0) |
| 19256 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19257 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19258 | if (err < 0) |
| 19259 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19260 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19261 | if (err < 0) |
| 19262 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19263 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19264 | if (err < 0) |
| 19265 | return err; |
| 19266 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19267 | const char *name = pfx; |
| 19268 | if (!name) |
| 19269 | name = chname[i]; |
| 19270 | err = __alc662_add_vol_ctl(spec, name, nid, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19271 | if (err < 0) |
| 19272 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19273 | err = __alc662_add_sw_ctl(spec, name, mix, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19274 | if (err < 0) |
| 19275 | return err; |
| 19276 | } |
| 19277 | } |
| 19278 | return 0; |
| 19279 | } |
| 19280 | |
| 19281 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19282 | /* return DAC nid if any new DAC is assigned */ |
| 19283 | 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] | 19284 | const char *pfx) |
| 19285 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19286 | struct alc_spec *spec = codec->spec; |
| 19287 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19288 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19289 | |
| 19290 | if (!pin) |
| 19291 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19292 | nid = alc662_look_for_dac(codec, pin); |
| 19293 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19294 | /* the corresponding DAC is already occupied */ |
| 19295 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19296 | return 0; /* no way */ |
| 19297 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19298 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19299 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19300 | } |
| 19301 | |
| 19302 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19303 | if (!mix) |
| 19304 | return 0; |
| 19305 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19306 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19307 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19308 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19309 | if (err < 0) |
| 19310 | return err; |
| 19311 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19312 | } |
| 19313 | |
| 19314 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19315 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19316 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19317 | |
| 19318 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19319 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19320 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19321 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19322 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19323 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19324 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19325 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19326 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19327 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19328 | if (num <= 1) |
| 19329 | return; |
| 19330 | for (i = 0; i < num; i++) { |
| 19331 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19332 | continue; |
| 19333 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19334 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19335 | } |
| 19336 | } |
| 19337 | |
| 19338 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19339 | { |
| 19340 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19341 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19342 | int i; |
| 19343 | |
| 19344 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19345 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19346 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19347 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19348 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19349 | } |
| 19350 | } |
| 19351 | |
| 19352 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19353 | { |
| 19354 | struct alc_spec *spec = codec->spec; |
| 19355 | hda_nid_t pin; |
| 19356 | |
| 19357 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19358 | if (pin) |
| 19359 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19360 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19361 | pin = spec->autocfg.speaker_pins[0]; |
| 19362 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19363 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19364 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19365 | } |
| 19366 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19367 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19368 | |
| 19369 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19370 | { |
| 19371 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19372 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19373 | int i; |
| 19374 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19375 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19376 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19377 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19378 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19379 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19380 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19381 | snd_hda_codec_write(codec, nid, 0, |
| 19382 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19383 | AMP_OUT_MUTE); |
| 19384 | } |
| 19385 | } |
| 19386 | } |
| 19387 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19388 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19389 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19390 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19391 | { |
| 19392 | struct alc_spec *spec = codec->spec; |
| 19393 | int err; |
| 19394 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19395 | |
| 19396 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19397 | alc662_ignore); |
| 19398 | if (err < 0) |
| 19399 | return err; |
| 19400 | if (!spec->autocfg.line_outs) |
| 19401 | return 0; /* can't find valid BIOS pin config */ |
| 19402 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19403 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19404 | if (err < 0) |
| 19405 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19406 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19407 | if (err < 0) |
| 19408 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19409 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19410 | spec->autocfg.speaker_pins[0], |
| 19411 | "Speaker"); |
| 19412 | if (err < 0) |
| 19413 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19414 | if (err) |
| 19415 | spec->multiout.extra_out_nid[0] = err; |
| 19416 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19417 | "Headphone"); |
| 19418 | if (err < 0) |
| 19419 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19420 | if (err) |
| 19421 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19422 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19423 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19424 | return err; |
| 19425 | |
| 19426 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19427 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19428 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19429 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19430 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19431 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19432 | |
| 19433 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19434 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19435 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19436 | add_verb(spec, alc662_init_verbs); |
| 19437 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19438 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19439 | add_verb(spec, alc663_init_verbs); |
| 19440 | |
| 19441 | if (codec->vendor_id == 0x10ec0272) |
| 19442 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19443 | |
| 19444 | err = alc_auto_add_mic_boost(codec); |
| 19445 | if (err < 0) |
| 19446 | return err; |
| 19447 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19448 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19449 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19450 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19451 | else |
| 19452 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19453 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19454 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19455 | } |
| 19456 | |
| 19457 | /* additional initialization for auto-configuration model */ |
| 19458 | static void alc662_auto_init(struct hda_codec *codec) |
| 19459 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19460 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19461 | alc662_auto_init_multi_out(codec); |
| 19462 | alc662_auto_init_hp_out(codec); |
| 19463 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19464 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19465 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19466 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19467 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19468 | } |
| 19469 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19470 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19471 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19472 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19473 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19474 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19475 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19476 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19477 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19478 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19479 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19480 | printk(KERN_WARNING |
| 19481 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19482 | } |
| 19483 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19484 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19485 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19486 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19487 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19488 | ALC662_FIXUP_CZC_P10T, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19489 | }; |
| 19490 | |
| 19491 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19492 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19493 | .type = ALC_FIXUP_PINS, |
| 19494 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19495 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19496 | { } |
| 19497 | } |
| 19498 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19499 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19500 | .type = ALC_FIXUP_PINS, |
| 19501 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19502 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19503 | { } |
| 19504 | } |
| 19505 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19506 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19507 | .type = ALC_FIXUP_FUNC, |
| 19508 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19509 | }, |
| 19510 | [ALC662_FIXUP_CZC_P10T] = { |
| 19511 | .type = ALC_FIXUP_VERBS, |
| 19512 | .v.verbs = (const struct hda_verb[]) { |
| 19513 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19514 | {} |
| 19515 | } |
| 19516 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19517 | }; |
| 19518 | |
| 19519 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 19520 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19521 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19522 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19523 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19524 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19525 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19526 | {} |
| 19527 | }; |
| 19528 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19529 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19530 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19531 | {} |
| 19532 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19533 | |
| 19534 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19535 | static int patch_alc662(struct hda_codec *codec) |
| 19536 | { |
| 19537 | struct alc_spec *spec; |
| 19538 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19539 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19540 | |
| 19541 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19542 | if (!spec) |
| 19543 | return -ENOMEM; |
| 19544 | |
| 19545 | codec->spec = spec; |
| 19546 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19547 | alc_auto_parse_customize_define(codec); |
| 19548 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19549 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19550 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19551 | coef = alc_read_coef_idx(codec, 0); |
| 19552 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19553 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19554 | else if (coef & (1 << 14) && |
| 19555 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19556 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19557 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19558 | else if (coef == 0x4011) |
| 19559 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19560 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19561 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19562 | alc662_models, |
| 19563 | alc662_cfg_tbl); |
| 19564 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19565 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19566 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19567 | board_config = ALC662_AUTO; |
| 19568 | } |
| 19569 | |
| 19570 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19571 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19572 | alc662_fixup_tbl, alc662_fixups); |
| 19573 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19574 | /* automatic parse from the BIOS config */ |
| 19575 | err = alc662_parse_auto_config(codec); |
| 19576 | if (err < 0) { |
| 19577 | alc_free(codec); |
| 19578 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19579 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19580 | printk(KERN_INFO |
| 19581 | "hda_codec: Cannot set up configuration " |
| 19582 | "from BIOS. Using base mode...\n"); |
| 19583 | board_config = ALC662_3ST_2ch_DIG; |
| 19584 | } |
| 19585 | } |
| 19586 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19587 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19588 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19589 | if (err < 0) { |
| 19590 | alc_free(codec); |
| 19591 | return err; |
| 19592 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19593 | } |
| 19594 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19595 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19596 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19597 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19598 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19599 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19600 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19601 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19602 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19603 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19604 | if (!spec->adc_nids) { |
| 19605 | spec->adc_nids = alc662_adc_nids; |
| 19606 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19607 | } |
| 19608 | if (!spec->capsrc_nids) |
| 19609 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19610 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19611 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19612 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19613 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19614 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19615 | switch (codec->vendor_id) { |
| 19616 | case 0x10ec0662: |
| 19617 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19618 | break; |
| 19619 | case 0x10ec0272: |
| 19620 | case 0x10ec0663: |
| 19621 | case 0x10ec0665: |
| 19622 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19623 | break; |
| 19624 | case 0x10ec0273: |
| 19625 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19626 | break; |
| 19627 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19628 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19629 | spec->vmaster_nid = 0x02; |
| 19630 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19631 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19632 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19633 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19634 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19635 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19636 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19637 | alc_init_jacks(codec); |
| 19638 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19639 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19640 | if (!spec->loopback.amplist) |
| 19641 | spec->loopback.amplist = alc662_loopbacks; |
| 19642 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19643 | |
| 19644 | return 0; |
| 19645 | } |
| 19646 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19647 | static int patch_alc888(struct hda_codec *codec) |
| 19648 | { |
| 19649 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19650 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19651 | if (codec->vendor_id == 0x10ec0887) |
| 19652 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19653 | else |
| 19654 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19655 | if (!codec->chip_name) { |
| 19656 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19657 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19658 | } |
| 19659 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19660 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19661 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19662 | } |
| 19663 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19664 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19665 | * ALC680 support |
| 19666 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19667 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19668 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19669 | #define alc680_modes alc260_modes |
| 19670 | |
| 19671 | static hda_nid_t alc680_dac_nids[3] = { |
| 19672 | /* Lout1, Lout2, hp */ |
| 19673 | 0x02, 0x03, 0x04 |
| 19674 | }; |
| 19675 | |
| 19676 | static hda_nid_t alc680_adc_nids[3] = { |
| 19677 | /* ADC0-2 */ |
| 19678 | /* DMIC, MIC, Line-in*/ |
| 19679 | 0x07, 0x08, 0x09 |
| 19680 | }; |
| 19681 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19682 | /* |
| 19683 | * Analog capture ADC cgange |
| 19684 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19685 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19686 | { |
| 19687 | struct alc_spec *spec = codec->spec; |
| 19688 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19689 | int pin_found = 0; |
| 19690 | int type_found = AUTO_PIN_LAST; |
| 19691 | hda_nid_t nid; |
| 19692 | int i; |
| 19693 | |
| 19694 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19695 | nid = cfg->inputs[i].pin; |
| 19696 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19697 | AC_PINCAP_PRES_DETECT)) |
| 19698 | continue; |
| 19699 | if (snd_hda_jack_detect(codec, nid)) { |
| 19700 | if (cfg->inputs[i].type < type_found) { |
| 19701 | type_found = cfg->inputs[i].type; |
| 19702 | pin_found = nid; |
| 19703 | } |
| 19704 | } |
| 19705 | } |
| 19706 | |
| 19707 | nid = 0x07; |
| 19708 | if (pin_found) |
| 19709 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19710 | |
| 19711 | if (nid != spec->cur_adc) |
| 19712 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19713 | spec->cur_adc = nid; |
| 19714 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19715 | spec->cur_adc_format); |
| 19716 | } |
| 19717 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19718 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19719 | struct hda_codec *codec, |
| 19720 | unsigned int stream_tag, |
| 19721 | unsigned int format, |
| 19722 | struct snd_pcm_substream *substream) |
| 19723 | { |
| 19724 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19725 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19726 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19727 | spec->cur_adc_stream_tag = stream_tag; |
| 19728 | spec->cur_adc_format = format; |
| 19729 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19730 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19731 | return 0; |
| 19732 | } |
| 19733 | |
| 19734 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19735 | struct hda_codec *codec, |
| 19736 | struct snd_pcm_substream *substream) |
| 19737 | { |
| 19738 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19739 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19740 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19741 | return 0; |
| 19742 | } |
| 19743 | |
| 19744 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19745 | .substreams = 1, /* can be overridden */ |
| 19746 | .channels_min = 2, |
| 19747 | .channels_max = 2, |
| 19748 | /* NID is set in alc_build_pcms */ |
| 19749 | .ops = { |
| 19750 | .prepare = alc680_capture_pcm_prepare, |
| 19751 | .cleanup = alc680_capture_pcm_cleanup |
| 19752 | }, |
| 19753 | }; |
| 19754 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19755 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19756 | /* output mixer control */ |
| 19757 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19758 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19759 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19760 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19761 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19762 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19763 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19764 | { } |
| 19765 | }; |
| 19766 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19767 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19768 | .ops = &snd_hda_bind_vol, |
| 19769 | .values = { |
| 19770 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19771 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19772 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19773 | 0 |
| 19774 | }, |
| 19775 | }; |
| 19776 | |
| 19777 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19778 | .ops = &snd_hda_bind_sw, |
| 19779 | .values = { |
| 19780 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19781 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19782 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19783 | 0 |
| 19784 | }, |
| 19785 | }; |
| 19786 | |
| 19787 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19788 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19789 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19790 | { } /* end */ |
| 19791 | }; |
| 19792 | |
| 19793 | /* |
| 19794 | * generic initialization of ADC, input mixers and output mixers |
| 19795 | */ |
| 19796 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19797 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19798 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19799 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19800 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19801 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19802 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19803 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19804 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19805 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19806 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19807 | |
| 19808 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19809 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19810 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19811 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19812 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19813 | |
| 19814 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19815 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19816 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19817 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19818 | { } |
| 19819 | }; |
| 19820 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19821 | /* toggle speaker-output according to the hp-jack state */ |
| 19822 | static void alc680_base_setup(struct hda_codec *codec) |
| 19823 | { |
| 19824 | struct alc_spec *spec = codec->spec; |
| 19825 | |
| 19826 | spec->autocfg.hp_pins[0] = 0x16; |
| 19827 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19828 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19829 | spec->autocfg.num_inputs = 2; |
| 19830 | spec->autocfg.inputs[0].pin = 0x18; |
| 19831 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19832 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19833 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19834 | } |
| 19835 | |
| 19836 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19837 | unsigned int res) |
| 19838 | { |
| 19839 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19840 | alc_automute_amp(codec); |
| 19841 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19842 | alc680_rec_autoswitch(codec); |
| 19843 | } |
| 19844 | |
| 19845 | static void alc680_inithook(struct hda_codec *codec) |
| 19846 | { |
| 19847 | alc_automute_amp(codec); |
| 19848 | alc680_rec_autoswitch(codec); |
| 19849 | } |
| 19850 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19851 | /* create input playback/capture controls for the given pin */ |
| 19852 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19853 | const char *ctlname, int idx) |
| 19854 | { |
| 19855 | hda_nid_t dac; |
| 19856 | int err; |
| 19857 | |
| 19858 | switch (nid) { |
| 19859 | case 0x14: |
| 19860 | dac = 0x02; |
| 19861 | break; |
| 19862 | case 0x15: |
| 19863 | dac = 0x03; |
| 19864 | break; |
| 19865 | case 0x16: |
| 19866 | dac = 0x04; |
| 19867 | break; |
| 19868 | default: |
| 19869 | return 0; |
| 19870 | } |
| 19871 | if (spec->multiout.dac_nids[0] != dac && |
| 19872 | spec->multiout.dac_nids[1] != dac) { |
| 19873 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19874 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19875 | HDA_OUTPUT)); |
| 19876 | if (err < 0) |
| 19877 | return err; |
| 19878 | |
| 19879 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19880 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19881 | |
| 19882 | if (err < 0) |
| 19883 | return err; |
| 19884 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19885 | } |
| 19886 | |
| 19887 | return 0; |
| 19888 | } |
| 19889 | |
| 19890 | /* add playback controls from the parsed DAC table */ |
| 19891 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19892 | const struct auto_pin_cfg *cfg) |
| 19893 | { |
| 19894 | hda_nid_t nid; |
| 19895 | int err; |
| 19896 | |
| 19897 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19898 | |
| 19899 | nid = cfg->line_out_pins[0]; |
| 19900 | if (nid) { |
| 19901 | const char *name; |
| 19902 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19903 | name = "Speaker"; |
| 19904 | else |
| 19905 | name = "Front"; |
| 19906 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19907 | if (err < 0) |
| 19908 | return err; |
| 19909 | } |
| 19910 | |
| 19911 | nid = cfg->speaker_pins[0]; |
| 19912 | if (nid) { |
| 19913 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19914 | if (err < 0) |
| 19915 | return err; |
| 19916 | } |
| 19917 | nid = cfg->hp_pins[0]; |
| 19918 | if (nid) { |
| 19919 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19920 | if (err < 0) |
| 19921 | return err; |
| 19922 | } |
| 19923 | |
| 19924 | return 0; |
| 19925 | } |
| 19926 | |
| 19927 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19928 | hda_nid_t nid, int pin_type) |
| 19929 | { |
| 19930 | alc_set_pin_output(codec, nid, pin_type); |
| 19931 | } |
| 19932 | |
| 19933 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19934 | { |
| 19935 | struct alc_spec *spec = codec->spec; |
| 19936 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19937 | if (nid) { |
| 19938 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19939 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19940 | } |
| 19941 | } |
| 19942 | |
| 19943 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19944 | { |
| 19945 | struct alc_spec *spec = codec->spec; |
| 19946 | hda_nid_t pin; |
| 19947 | |
| 19948 | pin = spec->autocfg.hp_pins[0]; |
| 19949 | if (pin) |
| 19950 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19951 | pin = spec->autocfg.speaker_pins[0]; |
| 19952 | if (pin) |
| 19953 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19954 | } |
| 19955 | |
| 19956 | /* pcm configuration: identical with ALC880 */ |
| 19957 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19958 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19959 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19960 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19961 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19962 | |
| 19963 | /* |
| 19964 | * BIOS auto configuration |
| 19965 | */ |
| 19966 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19967 | { |
| 19968 | struct alc_spec *spec = codec->spec; |
| 19969 | int err; |
| 19970 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19971 | |
| 19972 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19973 | alc680_ignore); |
| 19974 | if (err < 0) |
| 19975 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19976 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19977 | if (!spec->autocfg.line_outs) { |
| 19978 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19979 | spec->multiout.max_channels = 2; |
| 19980 | spec->no_analog = 1; |
| 19981 | goto dig_only; |
| 19982 | } |
| 19983 | return 0; /* can't find valid BIOS pin config */ |
| 19984 | } |
| 19985 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19986 | if (err < 0) |
| 19987 | return err; |
| 19988 | |
| 19989 | spec->multiout.max_channels = 2; |
| 19990 | |
| 19991 | dig_only: |
| 19992 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19993 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19994 | if (spec->kctls.list) |
| 19995 | add_mixer(spec, spec->kctls.list); |
| 19996 | |
| 19997 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19998 | |
| 19999 | err = alc_auto_add_mic_boost(codec); |
| 20000 | if (err < 0) |
| 20001 | return err; |
| 20002 | |
| 20003 | return 1; |
| 20004 | } |
| 20005 | |
| 20006 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 20007 | |
| 20008 | /* init callback for auto-configuration model -- overriding the default init */ |
| 20009 | static void alc680_auto_init(struct hda_codec *codec) |
| 20010 | { |
| 20011 | struct alc_spec *spec = codec->spec; |
| 20012 | alc680_auto_init_multi_out(codec); |
| 20013 | alc680_auto_init_hp_out(codec); |
| 20014 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 20015 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20016 | if (spec->unsol_event) |
| 20017 | alc_inithook(codec); |
| 20018 | } |
| 20019 | |
| 20020 | /* |
| 20021 | * configuration and preset |
| 20022 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 20023 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 20024 | [ALC680_BASE] = "base", |
| 20025 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20026 | }; |
| 20027 | |
| 20028 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 20029 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 20030 | {} |
| 20031 | }; |
| 20032 | |
| 20033 | static struct alc_config_preset alc680_presets[] = { |
| 20034 | [ALC680_BASE] = { |
| 20035 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20036 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20037 | .init_verbs = { alc680_init_verbs }, |
| 20038 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 20039 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20040 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 20041 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 20042 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20043 | .unsol_event = alc680_unsol_event, |
| 20044 | .setup = alc680_base_setup, |
| 20045 | .init_hook = alc680_inithook, |
| 20046 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20047 | }, |
| 20048 | }; |
| 20049 | |
| 20050 | static int patch_alc680(struct hda_codec *codec) |
| 20051 | { |
| 20052 | struct alc_spec *spec; |
| 20053 | int board_config; |
| 20054 | int err; |
| 20055 | |
| 20056 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 20057 | if (spec == NULL) |
| 20058 | return -ENOMEM; |
| 20059 | |
| 20060 | codec->spec = spec; |
| 20061 | |
| 20062 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 20063 | alc680_models, |
| 20064 | alc680_cfg_tbl); |
| 20065 | |
| 20066 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 20067 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 20068 | codec->chip_name); |
| 20069 | board_config = ALC680_AUTO; |
| 20070 | } |
| 20071 | |
| 20072 | if (board_config == ALC680_AUTO) { |
| 20073 | /* automatic parse from the BIOS config */ |
| 20074 | err = alc680_parse_auto_config(codec); |
| 20075 | if (err < 0) { |
| 20076 | alc_free(codec); |
| 20077 | return err; |
| 20078 | } else if (!err) { |
| 20079 | printk(KERN_INFO |
| 20080 | "hda_codec: Cannot set up configuration " |
| 20081 | "from BIOS. Using base mode...\n"); |
| 20082 | board_config = ALC680_BASE; |
| 20083 | } |
| 20084 | } |
| 20085 | |
| 20086 | if (board_config != ALC680_AUTO) |
| 20087 | setup_preset(codec, &alc680_presets[board_config]); |
| 20088 | |
| 20089 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20090 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20091 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20092 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20093 | |
| 20094 | if (!spec->adc_nids) { |
| 20095 | spec->adc_nids = alc680_adc_nids; |
| 20096 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 20097 | } |
| 20098 | |
| 20099 | if (!spec->cap_mixer) |
| 20100 | set_capture_mixer(codec); |
| 20101 | |
| 20102 | spec->vmaster_nid = 0x02; |
| 20103 | |
| 20104 | codec->patch_ops = alc_patch_ops; |
| 20105 | if (board_config == ALC680_AUTO) |
| 20106 | spec->init_hook = alc680_auto_init; |
| 20107 | |
| 20108 | return 0; |
| 20109 | } |
| 20110 | |
| 20111 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20112 | * patch entries |
| 20113 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20114 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20115 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20116 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20117 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 20118 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20119 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20120 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 20121 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20122 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20123 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20124 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20125 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 20126 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 20127 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20128 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20129 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20130 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 20131 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 20132 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 20133 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 20134 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20135 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20136 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20137 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20138 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 20139 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20140 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 20141 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20142 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20143 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 20144 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 20145 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20146 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20147 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20148 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20149 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20150 | {} /* terminator */ |
| 20151 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20152 | |
| 20153 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 20154 | |
| 20155 | MODULE_LICENSE("GPL"); |
| 20156 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 20157 | |
| 20158 | static struct hda_codec_preset_list realtek_list = { |
| 20159 | .preset = snd_hda_preset_realtek, |
| 20160 | .owner = THIS_MODULE, |
| 20161 | }; |
| 20162 | |
| 20163 | static int __init patch_realtek_init(void) |
| 20164 | { |
| 20165 | return snd_hda_add_codec_preset(&realtek_list); |
| 20166 | } |
| 20167 | |
| 20168 | static void __exit patch_realtek_exit(void) |
| 20169 | { |
| 20170 | snd_hda_delete_codec_preset(&realtek_list); |
| 20171 | } |
| 20172 | |
| 20173 | module_init(patch_realtek_init) |
| 20174 | module_exit(patch_realtek_exit) |