Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
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 | 7cf51e4 | 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 | bab282b | 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 | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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; |
| 1724 | const char *modelname = spec->fixup_name; |
| 1725 | int depth = 0; |
| 1726 | |
| 1727 | if (!spec->fixup_list) |
| 1728 | return; |
| 1729 | |
| 1730 | while (id >= 0) { |
| 1731 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1732 | const struct alc_pincfg *cfg; |
| 1733 | |
| 1734 | switch (fix->type) { |
| 1735 | case ALC_FIXUP_SKU: |
| 1736 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1737 | break;; |
| 1738 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1739 | "Apply sku override for %s\n", |
| 1740 | codec->chip_name, modelname); |
| 1741 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1742 | spec->cdefine.fixup = 1; |
| 1743 | break; |
| 1744 | case ALC_FIXUP_PINS: |
| 1745 | cfg = fix->v.pins; |
| 1746 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1747 | break; |
| 1748 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1749 | "Apply pincfg for %s\n", |
| 1750 | codec->chip_name, modelname); |
| 1751 | for (; cfg->nid; cfg++) |
| 1752 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1753 | cfg->val); |
| 1754 | break; |
| 1755 | case ALC_FIXUP_VERBS: |
| 1756 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1757 | break; |
| 1758 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1759 | "Apply fix-verbs for %s\n", |
| 1760 | codec->chip_name, modelname); |
| 1761 | add_verb(codec->spec, fix->v.verbs); |
| 1762 | break; |
| 1763 | case ALC_FIXUP_FUNC: |
| 1764 | if (!fix->v.func) |
| 1765 | break; |
| 1766 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1767 | "Apply fix-func for %s\n", |
| 1768 | codec->chip_name, modelname); |
| 1769 | fix->v.func(codec, fix, action); |
| 1770 | break; |
| 1771 | default: |
| 1772 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1773 | "Invalid fixup type %d\n", |
| 1774 | codec->chip_name, fix->type); |
| 1775 | break; |
| 1776 | } |
| 1777 | if (!fix[id].chained) |
| 1778 | break; |
| 1779 | if (++depth > 10) |
| 1780 | break; |
| 1781 | id = fix[id].chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1782 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1783 | } |
| 1784 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1785 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1786 | const struct alc_model_fixup *models, |
| 1787 | const struct snd_pci_quirk *quirk, |
| 1788 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1789 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1790 | struct alc_spec *spec = codec->spec; |
| 1791 | int id = -1; |
| 1792 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1793 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1794 | if (codec->modelname && models) { |
| 1795 | while (models->name) { |
| 1796 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1797 | id = models->id; |
| 1798 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1799 | break; |
| 1800 | } |
| 1801 | models++; |
| 1802 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1803 | } |
| 1804 | if (id < 0) { |
| 1805 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1806 | if (quirk) { |
| 1807 | id = quirk->value; |
| 1808 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1809 | name = quirk->name; |
| 1810 | #endif |
| 1811 | } |
| 1812 | } |
| 1813 | |
| 1814 | spec->fixup_id = id; |
| 1815 | if (id >= 0) { |
| 1816 | spec->fixup_list = fixlist; |
| 1817 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1818 | } |
| 1819 | } |
| 1820 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1821 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1822 | unsigned int coef_idx) |
| 1823 | { |
| 1824 | unsigned int val; |
| 1825 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1826 | coef_idx); |
| 1827 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1828 | AC_VERB_GET_PROC_COEF, 0); |
| 1829 | return val; |
| 1830 | } |
| 1831 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1832 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1833 | unsigned int coef_val) |
| 1834 | { |
| 1835 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1836 | coef_idx); |
| 1837 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1838 | coef_val); |
| 1839 | } |
| 1840 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1841 | /* set right pin controls for digital I/O */ |
| 1842 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1843 | { |
| 1844 | struct alc_spec *spec = codec->spec; |
| 1845 | int i; |
| 1846 | hda_nid_t pin; |
| 1847 | |
| 1848 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1849 | pin = spec->autocfg.dig_out_pins[i]; |
| 1850 | if (pin) { |
| 1851 | snd_hda_codec_write(codec, pin, 0, |
| 1852 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1853 | PIN_OUT); |
| 1854 | } |
| 1855 | } |
| 1856 | pin = spec->autocfg.dig_in_pin; |
| 1857 | if (pin) |
| 1858 | snd_hda_codec_write(codec, pin, 0, |
| 1859 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1860 | PIN_IN); |
| 1861 | } |
| 1862 | |
| 1863 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1864 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1865 | { |
| 1866 | struct alc_spec *spec = codec->spec; |
| 1867 | int i, err; |
| 1868 | hda_nid_t dig_nid; |
| 1869 | |
| 1870 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1871 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1872 | err = snd_hda_get_connections(codec, |
| 1873 | spec->autocfg.dig_out_pins[i], |
| 1874 | &dig_nid, 1); |
| 1875 | if (err < 0) |
| 1876 | continue; |
| 1877 | if (!i) { |
| 1878 | spec->multiout.dig_out_nid = dig_nid; |
| 1879 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1880 | } else { |
| 1881 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1882 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1883 | break; |
| 1884 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1885 | } |
| 1886 | } |
| 1887 | |
| 1888 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1889 | dig_nid = codec->start_nid; |
| 1890 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1891 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1892 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1893 | continue; |
| 1894 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1895 | continue; |
| 1896 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1897 | continue; |
| 1898 | err = get_connection_index(codec, dig_nid, |
| 1899 | spec->autocfg.dig_in_pin); |
| 1900 | if (err >= 0) { |
| 1901 | spec->dig_in_nid = dig_nid; |
| 1902 | break; |
| 1903 | } |
| 1904 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1905 | } |
| 1906 | } |
| 1907 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1908 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1909 | * ALC888 |
| 1910 | */ |
| 1911 | |
| 1912 | /* |
| 1913 | * 2ch mode |
| 1914 | */ |
| 1915 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1916 | /* Mic-in jack as mic in */ |
| 1917 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1918 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1919 | /* Line-in jack as Line in */ |
| 1920 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1921 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1922 | /* Line-Out as Front */ |
| 1923 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1924 | { } /* end */ |
| 1925 | }; |
| 1926 | |
| 1927 | /* |
| 1928 | * 4ch mode |
| 1929 | */ |
| 1930 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1931 | /* Mic-in jack as mic in */ |
| 1932 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1933 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1934 | /* Line-in jack as Surround */ |
| 1935 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1936 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1937 | /* Line-Out as Front */ |
| 1938 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1939 | { } /* end */ |
| 1940 | }; |
| 1941 | |
| 1942 | /* |
| 1943 | * 6ch mode |
| 1944 | */ |
| 1945 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1946 | /* Mic-in jack as CLFE */ |
| 1947 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1948 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1949 | /* Line-in jack as Surround */ |
| 1950 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1951 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1952 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1953 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1954 | { } /* end */ |
| 1955 | }; |
| 1956 | |
| 1957 | /* |
| 1958 | * 8ch mode |
| 1959 | */ |
| 1960 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1961 | /* Mic-in jack as CLFE */ |
| 1962 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1963 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1964 | /* Line-in jack as Surround */ |
| 1965 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1966 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1967 | /* Line-Out as Side */ |
| 1968 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1969 | { } /* end */ |
| 1970 | }; |
| 1971 | |
| 1972 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1973 | { 2, alc888_4ST_ch2_intel_init }, |
| 1974 | { 4, alc888_4ST_ch4_intel_init }, |
| 1975 | { 6, alc888_4ST_ch6_intel_init }, |
| 1976 | { 8, alc888_4ST_ch8_intel_init }, |
| 1977 | }; |
| 1978 | |
| 1979 | /* |
| 1980 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1981 | */ |
| 1982 | |
| 1983 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1984 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1985 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1986 | /* Connect Internal HP to Front */ |
| 1987 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1988 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1989 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1990 | /* Connect Bass HP to Front */ |
| 1991 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1992 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1993 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1994 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1995 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1996 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1997 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1998 | /* Connect Mic jack to CLFE */ |
| 1999 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2000 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2001 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2002 | /* Connect Line-in jack to Surround */ |
| 2003 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2004 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2005 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2006 | /* Connect HP out jack to Front */ |
| 2007 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2008 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2009 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2010 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 2011 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2012 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2013 | {} |
| 2014 | }; |
| 2015 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2016 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2017 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 2018 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2019 | } |
| 2020 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2021 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 2022 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2023 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2024 | if (codec->vendor_id == 0x10ec0880) |
| 2025 | res >>= 28; |
| 2026 | else |
| 2027 | res >>= 26; |
| 2028 | if (res == ALC880_HP_EVENT) |
| 2029 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2030 | } |
| 2031 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2032 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2033 | { |
| 2034 | struct alc_spec *spec = codec->spec; |
| 2035 | |
| 2036 | spec->autocfg.hp_pins[0] = 0x15; |
| 2037 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2038 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2039 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2040 | spec->autocfg.speaker_pins[3] = 0x19; |
| 2041 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2042 | } |
| 2043 | |
| 2044 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 2045 | { |
| 2046 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2047 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2048 | } |
| 2049 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2050 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2051 | { |
| 2052 | struct alc_spec *spec = codec->spec; |
| 2053 | |
| 2054 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 2055 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 2056 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 2057 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2058 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2059 | |
| 2060 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2061 | * ALC888 Acer Aspire 4930G model |
| 2062 | */ |
| 2063 | |
| 2064 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 2065 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2066 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2067 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2069 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2070 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2071 | /* Connect Internal HP to front */ |
| 2072 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2073 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2074 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2075 | /* Connect HP out to front */ |
| 2076 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2077 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2078 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2079 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2080 | { } |
| 2081 | }; |
| 2082 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2083 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2084 | * ALC888 Acer Aspire 6530G model |
| 2085 | */ |
| 2086 | |
| 2087 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2088 | /* Route to built-in subwoofer as well as speakers */ |
| 2089 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2090 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2091 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2092 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2093 | /* Bias voltage on for external mic port */ |
| 2094 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2095 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2096 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2097 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2098 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2099 | /* Enable unsolicited event for HP jack */ |
| 2100 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2101 | /* Enable speaker output */ |
| 2102 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2103 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2104 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2105 | /* Enable headphone output */ |
| 2106 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2107 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2108 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2109 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2110 | { } |
| 2111 | }; |
| 2112 | |
| 2113 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2114 | *ALC888 Acer Aspire 7730G model |
| 2115 | */ |
| 2116 | |
| 2117 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2118 | /* Bias voltage on for external mic port */ |
| 2119 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2120 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2121 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2122 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2123 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2124 | /* Enable unsolicited event for HP jack */ |
| 2125 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2126 | /* Enable speaker output */ |
| 2127 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2128 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2129 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2130 | /* Enable headphone output */ |
| 2131 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2132 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2133 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2134 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2135 | /*Enable internal subwoofer */ |
| 2136 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2137 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2138 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2139 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2140 | { } |
| 2141 | }; |
| 2142 | |
| 2143 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2144 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2145 | */ |
| 2146 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2147 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2148 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2149 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2150 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2151 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2152 | /* Enable unsolicited event for HP jack */ |
| 2153 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2154 | /* Connect Internal Front to Front */ |
| 2155 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2156 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2157 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2158 | /* Connect Internal Rear to Rear */ |
| 2159 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2160 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2161 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2162 | /* Connect Internal CLFE to CLFE */ |
| 2163 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2164 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2165 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2166 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2167 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2168 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2169 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2170 | /* Enable all DACs */ |
| 2171 | /* DAC DISABLE/MUTE 1? */ |
| 2172 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2173 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2174 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2175 | /* DAC DISABLE/MUTE 2? */ |
| 2176 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2177 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2178 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2179 | /* DMIC fix |
| 2180 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2181 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2182 | * makes the signal become a difference/sum signal instead of standard |
| 2183 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2184 | * codec replicate the sum signal to both channels, turning it into a |
| 2185 | * normal mono mic. |
| 2186 | */ |
| 2187 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2188 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2189 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2190 | { } |
| 2191 | }; |
| 2192 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2193 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2194 | /* Front mic only available on one ADC */ |
| 2195 | { |
| 2196 | .num_items = 4, |
| 2197 | .items = { |
| 2198 | { "Mic", 0x0 }, |
| 2199 | { "Line", 0x2 }, |
| 2200 | { "CD", 0x4 }, |
| 2201 | { "Front Mic", 0xb }, |
| 2202 | }, |
| 2203 | }, |
| 2204 | { |
| 2205 | .num_items = 3, |
| 2206 | .items = { |
| 2207 | { "Mic", 0x0 }, |
| 2208 | { "Line", 0x2 }, |
| 2209 | { "CD", 0x4 }, |
| 2210 | }, |
| 2211 | } |
| 2212 | }; |
| 2213 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2214 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2215 | /* Interal mic only available on one ADC */ |
| 2216 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2217 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2218 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2219 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2220 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2221 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2222 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2223 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2224 | }, |
| 2225 | }, |
| 2226 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2227 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2228 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2229 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2230 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2231 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2232 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2233 | }, |
| 2234 | } |
| 2235 | }; |
| 2236 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2237 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2238 | /* Digital mic only available on first "ADC" */ |
| 2239 | { |
| 2240 | .num_items = 5, |
| 2241 | .items = { |
| 2242 | { "Mic", 0x0 }, |
| 2243 | { "Line", 0x2 }, |
| 2244 | { "CD", 0x4 }, |
| 2245 | { "Front Mic", 0xb }, |
| 2246 | { "Input Mix", 0xa }, |
| 2247 | }, |
| 2248 | }, |
| 2249 | { |
| 2250 | .num_items = 4, |
| 2251 | .items = { |
| 2252 | { "Mic", 0x0 }, |
| 2253 | { "Line", 0x2 }, |
| 2254 | { "CD", 0x4 }, |
| 2255 | { "Input Mix", 0xa }, |
| 2256 | }, |
| 2257 | }, |
| 2258 | { |
| 2259 | .num_items = 4, |
| 2260 | .items = { |
| 2261 | { "Mic", 0x0 }, |
| 2262 | { "Line", 0x2 }, |
| 2263 | { "CD", 0x4 }, |
| 2264 | { "Input Mix", 0xa }, |
| 2265 | }, |
| 2266 | } |
| 2267 | }; |
| 2268 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2269 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2270 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2271 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2272 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2273 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2274 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2275 | HDA_OUTPUT), |
| 2276 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2277 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2278 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2279 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2280 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2281 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2282 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2283 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2284 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2285 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2286 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2288 | { } /* end */ |
| 2289 | }; |
| 2290 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2291 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2292 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2293 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2294 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2295 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2296 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2297 | HDA_OUTPUT), |
| 2298 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2299 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2300 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2301 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2302 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2303 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2304 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2305 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2306 | { } /* end */ |
| 2307 | }; |
| 2308 | |
| 2309 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2310 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2311 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2312 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2313 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2314 | spec->autocfg.hp_pins[0] = 0x15; |
| 2315 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2316 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2317 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2318 | } |
| 2319 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2320 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2321 | { |
| 2322 | struct alc_spec *spec = codec->spec; |
| 2323 | |
| 2324 | spec->autocfg.hp_pins[0] = 0x15; |
| 2325 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2326 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2327 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2328 | } |
| 2329 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2330 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2331 | { |
| 2332 | struct alc_spec *spec = codec->spec; |
| 2333 | |
| 2334 | spec->autocfg.hp_pins[0] = 0x15; |
| 2335 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2336 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2337 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2338 | } |
| 2339 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2340 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2341 | { |
| 2342 | struct alc_spec *spec = codec->spec; |
| 2343 | |
| 2344 | spec->autocfg.hp_pins[0] = 0x15; |
| 2345 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2346 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2347 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2348 | } |
| 2349 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2350 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2351 | * ALC880 3-stack model |
| 2352 | * |
| 2353 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2354 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2355 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2356 | */ |
| 2357 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2358 | static hda_nid_t alc880_dac_nids[4] = { |
| 2359 | /* front, rear, clfe, rear_surr */ |
| 2360 | 0x02, 0x05, 0x04, 0x03 |
| 2361 | }; |
| 2362 | |
| 2363 | static hda_nid_t alc880_adc_nids[3] = { |
| 2364 | /* ADC0-2 */ |
| 2365 | 0x07, 0x08, 0x09, |
| 2366 | }; |
| 2367 | |
| 2368 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2369 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2370 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2371 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2372 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2373 | /* ADC1-2 */ |
| 2374 | 0x08, 0x09, |
| 2375 | }; |
| 2376 | |
| 2377 | #define ALC880_DIGOUT_NID 0x06 |
| 2378 | #define ALC880_DIGIN_NID 0x0a |
| 2379 | |
| 2380 | static struct hda_input_mux alc880_capture_source = { |
| 2381 | .num_items = 4, |
| 2382 | .items = { |
| 2383 | { "Mic", 0x0 }, |
| 2384 | { "Front Mic", 0x3 }, |
| 2385 | { "Line", 0x2 }, |
| 2386 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2387 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2388 | }; |
| 2389 | |
| 2390 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2391 | /* 2ch mode */ |
| 2392 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2393 | /* set line-in to input, mute it */ |
| 2394 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2395 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2396 | /* set mic-in to input vref 80%, mute it */ |
| 2397 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2398 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2399 | { } /* end */ |
| 2400 | }; |
| 2401 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2402 | /* 6ch mode */ |
| 2403 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2404 | /* set line-in to output, unmute it */ |
| 2405 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2406 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2407 | /* set mic-in to output, unmute it */ |
| 2408 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2409 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2410 | { } /* end */ |
| 2411 | }; |
| 2412 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2413 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2414 | { 2, alc880_threestack_ch2_init }, |
| 2415 | { 6, alc880_threestack_ch6_init }, |
| 2416 | }; |
| 2417 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2418 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2419 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2420 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2421 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2422 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2423 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2424 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2425 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2426 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2427 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2428 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2429 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2430 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2431 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2432 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2433 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2434 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2435 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2436 | { |
| 2437 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2438 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2439 | .info = alc_ch_mode_info, |
| 2440 | .get = alc_ch_mode_get, |
| 2441 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2442 | }, |
| 2443 | { } /* end */ |
| 2444 | }; |
| 2445 | |
| 2446 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2447 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2448 | struct snd_ctl_elem_info *uinfo) |
| 2449 | { |
| 2450 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2451 | struct alc_spec *spec = codec->spec; |
| 2452 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2453 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2454 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2455 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2456 | HDA_INPUT); |
| 2457 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2458 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2459 | return err; |
| 2460 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2461 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2462 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2463 | unsigned int size, unsigned int __user *tlv) |
| 2464 | { |
| 2465 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2466 | struct alc_spec *spec = codec->spec; |
| 2467 | int err; |
| 2468 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2469 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2470 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2471 | HDA_INPUT); |
| 2472 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2473 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2474 | return err; |
| 2475 | } |
| 2476 | |
| 2477 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2478 | struct snd_ctl_elem_value *ucontrol); |
| 2479 | |
| 2480 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2481 | struct snd_ctl_elem_value *ucontrol, |
| 2482 | getput_call_t func) |
| 2483 | { |
| 2484 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2485 | struct alc_spec *spec = codec->spec; |
| 2486 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2487 | int err; |
| 2488 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2489 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2490 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2491 | 3, 0, HDA_INPUT); |
| 2492 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2493 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2494 | return err; |
| 2495 | } |
| 2496 | |
| 2497 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2498 | struct snd_ctl_elem_value *ucontrol) |
| 2499 | { |
| 2500 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2501 | snd_hda_mixer_amp_volume_get); |
| 2502 | } |
| 2503 | |
| 2504 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2505 | struct snd_ctl_elem_value *ucontrol) |
| 2506 | { |
| 2507 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2508 | snd_hda_mixer_amp_volume_put); |
| 2509 | } |
| 2510 | |
| 2511 | /* capture mixer elements */ |
| 2512 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2513 | |
| 2514 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2515 | struct snd_ctl_elem_value *ucontrol) |
| 2516 | { |
| 2517 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2518 | snd_hda_mixer_amp_switch_get); |
| 2519 | } |
| 2520 | |
| 2521 | static int alc_cap_sw_put(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_switch_put); |
| 2526 | } |
| 2527 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2528 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2529 | { \ |
| 2530 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2531 | .name = "Capture Switch", \ |
| 2532 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2533 | .count = num, \ |
| 2534 | .info = alc_cap_sw_info, \ |
| 2535 | .get = alc_cap_sw_get, \ |
| 2536 | .put = alc_cap_sw_put, \ |
| 2537 | }, \ |
| 2538 | { \ |
| 2539 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2540 | .name = "Capture Volume", \ |
| 2541 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2542 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2543 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2544 | .count = num, \ |
| 2545 | .info = alc_cap_vol_info, \ |
| 2546 | .get = alc_cap_vol_get, \ |
| 2547 | .put = alc_cap_vol_put, \ |
| 2548 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2549 | } |
| 2550 | |
| 2551 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2552 | { \ |
| 2553 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2554 | /* .name = "Capture Source", */ \ |
| 2555 | .name = "Input Source", \ |
| 2556 | .count = num, \ |
| 2557 | .info = alc_mux_enum_info, \ |
| 2558 | .get = alc_mux_enum_get, \ |
| 2559 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2560 | } |
| 2561 | |
| 2562 | #define DEFINE_CAPMIX(num) \ |
| 2563 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2564 | _DEFINE_CAPMIX(num), \ |
| 2565 | _DEFINE_CAPSRC(num), \ |
| 2566 | { } /* end */ \ |
| 2567 | } |
| 2568 | |
| 2569 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2570 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2571 | _DEFINE_CAPMIX(num), \ |
| 2572 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2573 | } |
| 2574 | |
| 2575 | /* up to three ADCs */ |
| 2576 | DEFINE_CAPMIX(1); |
| 2577 | DEFINE_CAPMIX(2); |
| 2578 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2579 | DEFINE_CAPMIX_NOSRC(1); |
| 2580 | DEFINE_CAPMIX_NOSRC(2); |
| 2581 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2582 | |
| 2583 | /* |
| 2584 | * ALC880 5-stack model |
| 2585 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2586 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2587 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2588 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2589 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2590 | */ |
| 2591 | |
| 2592 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2593 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2594 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2595 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2596 | { } /* end */ |
| 2597 | }; |
| 2598 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2599 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2600 | /* 6ch mode */ |
| 2601 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2602 | /* set line-in to input, mute it */ |
| 2603 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2604 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2605 | { } /* end */ |
| 2606 | }; |
| 2607 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2608 | /* 8ch mode */ |
| 2609 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2610 | /* set line-in to output, unmute it */ |
| 2611 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2612 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2613 | { } /* end */ |
| 2614 | }; |
| 2615 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2616 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2617 | { 6, alc880_fivestack_ch6_init }, |
| 2618 | { 8, alc880_fivestack_ch8_init }, |
| 2619 | }; |
| 2620 | |
| 2621 | |
| 2622 | /* |
| 2623 | * ALC880 6-stack model |
| 2624 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2625 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2626 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2627 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2628 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2629 | */ |
| 2630 | |
| 2631 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2632 | /* front, rear, clfe, rear_surr */ |
| 2633 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2634 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2635 | |
| 2636 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2637 | .num_items = 4, |
| 2638 | .items = { |
| 2639 | { "Mic", 0x0 }, |
| 2640 | { "Front Mic", 0x1 }, |
| 2641 | { "Line", 0x2 }, |
| 2642 | { "CD", 0x4 }, |
| 2643 | }, |
| 2644 | }; |
| 2645 | |
| 2646 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2647 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2648 | { 8, NULL }, |
| 2649 | }; |
| 2650 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2651 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2652 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2653 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2654 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2655 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2656 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2657 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2658 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2659 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2660 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2661 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2662 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2663 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2664 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2665 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2666 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2667 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2668 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2669 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2670 | { |
| 2671 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2672 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2673 | .info = alc_ch_mode_info, |
| 2674 | .get = alc_ch_mode_get, |
| 2675 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2676 | }, |
| 2677 | { } /* end */ |
| 2678 | }; |
| 2679 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2680 | |
| 2681 | /* |
| 2682 | * ALC880 W810 model |
| 2683 | * |
| 2684 | * W810 has rear IO for: |
| 2685 | * Front (DAC 02) |
| 2686 | * Surround (DAC 03) |
| 2687 | * Center/LFE (DAC 04) |
| 2688 | * Digital out (06) |
| 2689 | * |
| 2690 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2691 | * 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] | 2692 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2693 | * There is a variable resistor to control the speaker or headphone |
| 2694 | * volume. This is a hardware-only device without a software API. |
| 2695 | * |
| 2696 | * Plugging headphones in will disable the internal speakers. This is |
| 2697 | * implemented in hardware, not via the driver using jack sense. In |
| 2698 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2699 | * disable both the speakers and headphones. |
| 2700 | * |
| 2701 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2702 | * These may not do anything useful with this driver yet, because I |
| 2703 | * haven't setup any initialization verbs for these yet... |
| 2704 | */ |
| 2705 | |
| 2706 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2707 | /* front, rear/surround, clfe */ |
| 2708 | 0x02, 0x03, 0x04 |
| 2709 | }; |
| 2710 | |
| 2711 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2712 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2713 | { 6, NULL } |
| 2714 | }; |
| 2715 | |
| 2716 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2717 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2718 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2719 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2720 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2721 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2722 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2723 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2724 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2725 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2726 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2727 | { } /* end */ |
| 2728 | }; |
| 2729 | |
| 2730 | |
| 2731 | /* |
| 2732 | * Z710V model |
| 2733 | * |
| 2734 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2735 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2736 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2737 | */ |
| 2738 | |
| 2739 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2740 | 0x02 |
| 2741 | }; |
| 2742 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2743 | |
| 2744 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2745 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2746 | { 2, NULL } |
| 2747 | }; |
| 2748 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2749 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2750 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2751 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2752 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2753 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2754 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2755 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2756 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2757 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2758 | { } /* end */ |
| 2759 | }; |
| 2760 | |
| 2761 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2762 | /* |
| 2763 | * ALC880 F1734 model |
| 2764 | * |
| 2765 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2766 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2767 | */ |
| 2768 | |
| 2769 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2770 | 0x03 |
| 2771 | }; |
| 2772 | #define ALC880_F1734_HP_DAC 0x02 |
| 2773 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2774 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2775 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2776 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2777 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2778 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2779 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2780 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2781 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2782 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2783 | { } /* end */ |
| 2784 | }; |
| 2785 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2786 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2787 | .num_items = 2, |
| 2788 | .items = { |
| 2789 | { "Mic", 0x1 }, |
| 2790 | { "CD", 0x4 }, |
| 2791 | }, |
| 2792 | }; |
| 2793 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2794 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2795 | /* |
| 2796 | * ALC880 ASUS model |
| 2797 | * |
| 2798 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2799 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2800 | * Mic = 0x18, Line = 0x1a |
| 2801 | */ |
| 2802 | |
| 2803 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2804 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2805 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2806 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2807 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2808 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2809 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2810 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2811 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2812 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2813 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2814 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2815 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2816 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2818 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2821 | { |
| 2822 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2823 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2824 | .info = alc_ch_mode_info, |
| 2825 | .get = alc_ch_mode_get, |
| 2826 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2827 | }, |
| 2828 | { } /* end */ |
| 2829 | }; |
| 2830 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2831 | /* |
| 2832 | * ALC880 ASUS W1V model |
| 2833 | * |
| 2834 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2835 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2836 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2837 | */ |
| 2838 | |
| 2839 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2840 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2841 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2842 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2843 | { } /* end */ |
| 2844 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2845 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2846 | /* TCL S700 */ |
| 2847 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2848 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2849 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2850 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2851 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2852 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2853 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2854 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2855 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2856 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2857 | { } /* end */ |
| 2858 | }; |
| 2859 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2860 | /* Uniwill */ |
| 2861 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2862 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2863 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2864 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2865 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2866 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2867 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2868 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2869 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2870 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2871 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2872 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2873 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2874 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2875 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2876 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2877 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2878 | { |
| 2879 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2880 | .name = "Channel Mode", |
| 2881 | .info = alc_ch_mode_info, |
| 2882 | .get = alc_ch_mode_get, |
| 2883 | .put = alc_ch_mode_put, |
| 2884 | }, |
| 2885 | { } /* end */ |
| 2886 | }; |
| 2887 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2888 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2889 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2890 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2891 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2892 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2893 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2894 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2895 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2896 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2897 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2898 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2899 | { } /* end */ |
| 2900 | }; |
| 2901 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2902 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2903 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2904 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2905 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2906 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2907 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2908 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2909 | { } /* end */ |
| 2910 | }; |
| 2911 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2912 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2913 | * virtual master controls |
| 2914 | */ |
| 2915 | |
| 2916 | /* |
| 2917 | * slave controls for virtual master |
| 2918 | */ |
| 2919 | static const char *alc_slave_vols[] = { |
| 2920 | "Front Playback Volume", |
| 2921 | "Surround Playback Volume", |
| 2922 | "Center Playback Volume", |
| 2923 | "LFE Playback Volume", |
| 2924 | "Side Playback Volume", |
| 2925 | "Headphone Playback Volume", |
| 2926 | "Speaker Playback Volume", |
| 2927 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2928 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2929 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2930 | NULL, |
| 2931 | }; |
| 2932 | |
| 2933 | static const char *alc_slave_sws[] = { |
| 2934 | "Front Playback Switch", |
| 2935 | "Surround Playback Switch", |
| 2936 | "Center Playback Switch", |
| 2937 | "LFE Playback Switch", |
| 2938 | "Side Playback Switch", |
| 2939 | "Headphone Playback Switch", |
| 2940 | "Speaker Playback Switch", |
| 2941 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2942 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2943 | "Line-Out Playback Switch", |
| 2944 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2945 | NULL, |
| 2946 | }; |
| 2947 | |
| 2948 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2949 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2950 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2951 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2952 | #define NID_MAPPING (-1) |
| 2953 | |
| 2954 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2955 | #define SUBDEV_HP_ (1 << 6) |
| 2956 | #define SUBDEV_LINE_ (2 << 6) |
| 2957 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2958 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2959 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2960 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2961 | static void alc_free_kctls(struct hda_codec *codec); |
| 2962 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2963 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2964 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2965 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2966 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2967 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2968 | { } /* end */ |
| 2969 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2970 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2971 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2972 | static int alc_build_controls(struct hda_codec *codec) |
| 2973 | { |
| 2974 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2975 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2976 | struct snd_kcontrol_new *knew; |
| 2977 | int i, j, err; |
| 2978 | unsigned int u; |
| 2979 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2980 | |
| 2981 | for (i = 0; i < spec->num_mixers; i++) { |
| 2982 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2983 | if (err < 0) |
| 2984 | return err; |
| 2985 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2986 | if (spec->cap_mixer) { |
| 2987 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2988 | if (err < 0) |
| 2989 | return err; |
| 2990 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2991 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2992 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2993 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2994 | if (err < 0) |
| 2995 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2996 | if (!spec->no_analog) { |
| 2997 | err = snd_hda_create_spdif_share_sw(codec, |
| 2998 | &spec->multiout); |
| 2999 | if (err < 0) |
| 3000 | return err; |
| 3001 | spec->multiout.share_spdif = 1; |
| 3002 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3003 | } |
| 3004 | if (spec->dig_in_nid) { |
| 3005 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 3006 | if (err < 0) |
| 3007 | return err; |
| 3008 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3009 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3010 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3011 | /* create beep controls if needed */ |
| 3012 | if (spec->beep_amp) { |
| 3013 | struct snd_kcontrol_new *knew; |
| 3014 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 3015 | struct snd_kcontrol *kctl; |
| 3016 | kctl = snd_ctl_new1(knew, codec); |
| 3017 | if (!kctl) |
| 3018 | return -ENOMEM; |
| 3019 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 3020 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3021 | if (err < 0) |
| 3022 | return err; |
| 3023 | } |
| 3024 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3025 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3026 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3027 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3028 | if (!spec->no_analog && |
| 3029 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3030 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3031 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3032 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3033 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3034 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3035 | if (err < 0) |
| 3036 | return err; |
| 3037 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3038 | if (!spec->no_analog && |
| 3039 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3040 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 3041 | NULL, alc_slave_sws); |
| 3042 | if (err < 0) |
| 3043 | return err; |
| 3044 | } |
| 3045 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3046 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 3047 | if (spec->capsrc_nids || spec->adc_nids) { |
| 3048 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 3049 | if (!kctl) |
| 3050 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3051 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3052 | hda_nid_t *nids = spec->capsrc_nids; |
| 3053 | if (!nids) |
| 3054 | nids = spec->adc_nids; |
| 3055 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3056 | if (err < 0) |
| 3057 | return err; |
| 3058 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3059 | } |
| 3060 | if (spec->cap_mixer) { |
| 3061 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3062 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3063 | if (kname && strcmp(knew->name, kname) == 0) |
| 3064 | continue; |
| 3065 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3066 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3067 | err = snd_hda_add_nid(codec, kctl, i, |
| 3068 | spec->adc_nids[i]); |
| 3069 | if (err < 0) |
| 3070 | return err; |
| 3071 | } |
| 3072 | } |
| 3073 | } |
| 3074 | |
| 3075 | /* other nid->control mapping */ |
| 3076 | for (i = 0; i < spec->num_mixers; i++) { |
| 3077 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3078 | if (knew->iface != NID_MAPPING) |
| 3079 | continue; |
| 3080 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3081 | if (kctl == NULL) |
| 3082 | continue; |
| 3083 | u = knew->subdevice; |
| 3084 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3085 | nid = u & 0x3f; |
| 3086 | if (nid == 0) |
| 3087 | continue; |
| 3088 | switch (u & 0xc0) { |
| 3089 | case SUBDEV_SPEAKER_: |
| 3090 | nid = spec->autocfg.speaker_pins[nid]; |
| 3091 | break; |
| 3092 | case SUBDEV_LINE_: |
| 3093 | nid = spec->autocfg.line_out_pins[nid]; |
| 3094 | break; |
| 3095 | case SUBDEV_HP_: |
| 3096 | nid = spec->autocfg.hp_pins[nid]; |
| 3097 | break; |
| 3098 | default: |
| 3099 | continue; |
| 3100 | } |
| 3101 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3102 | if (err < 0) |
| 3103 | return err; |
| 3104 | } |
| 3105 | u = knew->private_value; |
| 3106 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3107 | nid = u & 0xff; |
| 3108 | if (nid == 0) |
| 3109 | continue; |
| 3110 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3111 | if (err < 0) |
| 3112 | return err; |
| 3113 | } |
| 3114 | } |
| 3115 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3116 | |
| 3117 | alc_free_kctls(codec); /* no longer needed */ |
| 3118 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3119 | return 0; |
| 3120 | } |
| 3121 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3122 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3123 | /* |
| 3124 | * initialize the codec volumes, etc |
| 3125 | */ |
| 3126 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3127 | /* |
| 3128 | * generic initialization of ADC, input mixers and output mixers |
| 3129 | */ |
| 3130 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3131 | /* |
| 3132 | * Unmute ADC0-2 and set the default input to mic-in |
| 3133 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3134 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3135 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3136 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3137 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3138 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3139 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3140 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3141 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3142 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3143 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3144 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3145 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3146 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3147 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3148 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3149 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3150 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3151 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3152 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3153 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3154 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3155 | /* |
| 3156 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3157 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3158 | /* set vol=0 to output mixers */ |
| 3159 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3160 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3161 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3162 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3163 | /* set up input amps for analog loopback */ |
| 3164 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3165 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3166 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3167 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3168 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3169 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3170 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3171 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3172 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3173 | |
| 3174 | { } |
| 3175 | }; |
| 3176 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3177 | /* |
| 3178 | * 3-stack pin configuration: |
| 3179 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3180 | */ |
| 3181 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3182 | /* |
| 3183 | * preset connection lists of input pins |
| 3184 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3185 | */ |
| 3186 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3187 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3188 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3189 | |
| 3190 | /* |
| 3191 | * Set pin mode and muting |
| 3192 | */ |
| 3193 | /* set front pin widgets 0x14 for output */ |
| 3194 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3195 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3196 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3197 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3198 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3199 | /* Mic2 (as headphone out) for HP output */ |
| 3200 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3201 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3202 | /* Line In pin widget for input */ |
| 3203 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3204 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3205 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3206 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3207 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3208 | /* CD pin widget for input */ |
| 3209 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3210 | |
| 3211 | { } |
| 3212 | }; |
| 3213 | |
| 3214 | /* |
| 3215 | * 5-stack pin configuration: |
| 3216 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3217 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3218 | */ |
| 3219 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3220 | /* |
| 3221 | * preset connection lists of input pins |
| 3222 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3223 | */ |
| 3224 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3225 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3226 | |
| 3227 | /* |
| 3228 | * Set pin mode and muting |
| 3229 | */ |
| 3230 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3231 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3233 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3234 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3235 | /* unmute pins for output (no gain on this amp) */ |
| 3236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3238 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3239 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3240 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3241 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3242 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3243 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3244 | /* Mic2 (as headphone out) for HP output */ |
| 3245 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3246 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3247 | /* Line In pin widget for input */ |
| 3248 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3249 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3250 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3251 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3252 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3253 | /* CD pin widget for input */ |
| 3254 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3255 | |
| 3256 | { } |
| 3257 | }; |
| 3258 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3259 | /* |
| 3260 | * W810 pin configuration: |
| 3261 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3262 | */ |
| 3263 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3264 | /* hphone/speaker input selector: front DAC */ |
| 3265 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3266 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3267 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3268 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3269 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3270 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3271 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3272 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3273 | |
| 3274 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3275 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3276 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3277 | { } |
| 3278 | }; |
| 3279 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3280 | /* |
| 3281 | * Z71V pin configuration: |
| 3282 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3283 | */ |
| 3284 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3285 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3286 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3287 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3288 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3289 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3290 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3291 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3292 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3293 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3294 | |
| 3295 | { } |
| 3296 | }; |
| 3297 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3298 | /* |
| 3299 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3300 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3301 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3302 | */ |
| 3303 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3304 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3305 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3306 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3307 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3308 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3309 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3310 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3311 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3312 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3313 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3314 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3315 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3316 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3317 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3318 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3319 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3320 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3321 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3322 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3323 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3324 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3325 | { } |
| 3326 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3327 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3328 | /* |
| 3329 | * Uniwill pin configuration: |
| 3330 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3331 | * line = 0x1a |
| 3332 | */ |
| 3333 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3334 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3335 | |
| 3336 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3337 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3338 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3339 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3340 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3341 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3342 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3343 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3344 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3346 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3347 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3349 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3350 | |
| 3351 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3352 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3353 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3354 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3355 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3356 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3357 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3358 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3359 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3360 | |
| 3361 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3362 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3363 | |
| 3364 | { } |
| 3365 | }; |
| 3366 | |
| 3367 | /* |
| 3368 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3369 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3370 | */ |
| 3371 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3372 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3373 | |
| 3374 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3375 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3376 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3377 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3378 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3379 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3382 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3383 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3384 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3385 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3386 | |
| 3387 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3388 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3389 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3390 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3391 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3392 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3393 | |
| 3394 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3395 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3396 | |
| 3397 | { } |
| 3398 | }; |
| 3399 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3400 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3401 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3402 | { } |
| 3403 | }; |
| 3404 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3405 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3406 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3407 | { |
| 3408 | unsigned int present; |
| 3409 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3410 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3411 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3412 | bits = present ? HDA_AMP_MUTE : 0; |
| 3413 | 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] | 3414 | } |
| 3415 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3416 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3417 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3418 | struct alc_spec *spec = codec->spec; |
| 3419 | |
| 3420 | spec->autocfg.hp_pins[0] = 0x14; |
| 3421 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3422 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3423 | } |
| 3424 | |
| 3425 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3426 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3427 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3428 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3429 | } |
| 3430 | |
| 3431 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3432 | unsigned int res) |
| 3433 | { |
| 3434 | /* Looks like the unsol event is incompatible with the standard |
| 3435 | * definition. 4bit tag is placed at 28 bit! |
| 3436 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3437 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3438 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3439 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3440 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3441 | default: |
| 3442 | alc_automute_amp_unsol_event(codec, res); |
| 3443 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3444 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3445 | } |
| 3446 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3447 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3448 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3449 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3450 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3451 | spec->autocfg.hp_pins[0] = 0x14; |
| 3452 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3453 | } |
| 3454 | |
| 3455 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3456 | { |
| 3457 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3458 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3459 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3460 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3461 | present &= HDA_AMP_VOLMASK; |
| 3462 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3463 | HDA_AMP_VOLMASK, present); |
| 3464 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3465 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3466 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3467 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3468 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3469 | unsigned int res) |
| 3470 | { |
| 3471 | /* Looks like the unsol event is incompatible with the standard |
| 3472 | * definition. 4bit tag is placed at 28 bit! |
| 3473 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3474 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3475 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3476 | else |
| 3477 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3478 | } |
| 3479 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3480 | /* |
| 3481 | * F1734 pin configuration: |
| 3482 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3483 | */ |
| 3484 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3485 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3486 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3487 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3488 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3489 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3490 | |
| 3491 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3492 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3493 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3494 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3495 | |
| 3496 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3497 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3498 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3499 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3500 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3501 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3502 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3503 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3504 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3505 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3506 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3507 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3508 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3509 | { } |
| 3510 | }; |
| 3511 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3512 | /* |
| 3513 | * ASUS pin configuration: |
| 3514 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3515 | */ |
| 3516 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3517 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3518 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3519 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3520 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3521 | |
| 3522 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3523 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3524 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3525 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3526 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3527 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3528 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3529 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3530 | |
| 3531 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3532 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3533 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3534 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3535 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3536 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3537 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3538 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3539 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3540 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3541 | { } |
| 3542 | }; |
| 3543 | |
| 3544 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3545 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3546 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3547 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3548 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3549 | /* Clevo m520g init */ |
| 3550 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3551 | /* headphone output */ |
| 3552 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3553 | /* line-out */ |
| 3554 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3555 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3556 | /* Line-in */ |
| 3557 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3558 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3559 | /* CD */ |
| 3560 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3561 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3562 | /* Mic1 (rear panel) */ |
| 3563 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3564 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3565 | /* Mic2 (front panel) */ |
| 3566 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3567 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3568 | /* headphone */ |
| 3569 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3570 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3571 | /* change to EAPD mode */ |
| 3572 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3573 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3574 | |
| 3575 | { } |
| 3576 | }; |
| 3577 | |
| 3578 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3579 | /* change to EAPD mode */ |
| 3580 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3581 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3582 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3583 | /* Headphone output */ |
| 3584 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3585 | /* Front output*/ |
| 3586 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3587 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3588 | |
| 3589 | /* Line In pin widget for input */ |
| 3590 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3591 | /* CD pin widget for input */ |
| 3592 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3593 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3594 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3595 | |
| 3596 | /* change to EAPD mode */ |
| 3597 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3598 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3599 | |
| 3600 | { } |
| 3601 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3602 | |
| 3603 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3604 | * LG m1 express dual |
| 3605 | * |
| 3606 | * Pin assignment: |
| 3607 | * Rear Line-In/Out (blue): 0x14 |
| 3608 | * Build-in Mic-In: 0x15 |
| 3609 | * Speaker-out: 0x17 |
| 3610 | * HP-Out (green): 0x1b |
| 3611 | * Mic-In/Out (red): 0x19 |
| 3612 | * SPDIF-Out: 0x1e |
| 3613 | */ |
| 3614 | |
| 3615 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3616 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3617 | 0x05, 0x02, 0x03 |
| 3618 | }; |
| 3619 | |
| 3620 | /* seems analog CD is not working */ |
| 3621 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3622 | .num_items = 3, |
| 3623 | .items = { |
| 3624 | { "Mic", 0x1 }, |
| 3625 | { "Line", 0x5 }, |
| 3626 | { "Internal Mic", 0x6 }, |
| 3627 | }, |
| 3628 | }; |
| 3629 | |
| 3630 | /* 2,4,6 channel modes */ |
| 3631 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3632 | /* set line-in and mic-in to input */ |
| 3633 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3634 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3635 | { } |
| 3636 | }; |
| 3637 | |
| 3638 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3639 | /* set line-in to out and mic-in to input */ |
| 3640 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3641 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3642 | { } |
| 3643 | }; |
| 3644 | |
| 3645 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3646 | /* set line-in and mic-in to output */ |
| 3647 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3648 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3649 | { } |
| 3650 | }; |
| 3651 | |
| 3652 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3653 | { 2, alc880_lg_ch2_init }, |
| 3654 | { 4, alc880_lg_ch4_init }, |
| 3655 | { 6, alc880_lg_ch6_init }, |
| 3656 | }; |
| 3657 | |
| 3658 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3659 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3660 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3661 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3662 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3663 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3664 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3665 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3666 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3669 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3670 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3671 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3672 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3673 | { |
| 3674 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3675 | .name = "Channel Mode", |
| 3676 | .info = alc_ch_mode_info, |
| 3677 | .get = alc_ch_mode_get, |
| 3678 | .put = alc_ch_mode_put, |
| 3679 | }, |
| 3680 | { } /* end */ |
| 3681 | }; |
| 3682 | |
| 3683 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3684 | /* set capture source to mic-in */ |
| 3685 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3686 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3687 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3688 | /* mute all amp mixer inputs */ |
| 3689 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3690 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3691 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3692 | /* line-in to input */ |
| 3693 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3694 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3695 | /* built-in mic */ |
| 3696 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3697 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3698 | /* speaker-out */ |
| 3699 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3700 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3701 | /* mic-in to input */ |
| 3702 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3703 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3704 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3705 | /* HP-out */ |
| 3706 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3707 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3708 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3709 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3710 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3711 | { } |
| 3712 | }; |
| 3713 | |
| 3714 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3715 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3716 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3717 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3718 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3719 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3720 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3721 | } |
| 3722 | |
| 3723 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3724 | * LG LW20 |
| 3725 | * |
| 3726 | * Pin assignment: |
| 3727 | * Speaker-out: 0x14 |
| 3728 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3729 | * Built-in Mic-In: 0x19 |
| 3730 | * Line-In: 0x1b |
| 3731 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3732 | * SPDIF-Out: 0x1e |
| 3733 | */ |
| 3734 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3735 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3736 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3737 | .items = { |
| 3738 | { "Mic", 0x0 }, |
| 3739 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3740 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3741 | }, |
| 3742 | }; |
| 3743 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3744 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3745 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3746 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3747 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3748 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3749 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3750 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3751 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3752 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3753 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3754 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3755 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3756 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3757 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3758 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3759 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3760 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3761 | { |
| 3762 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3763 | .name = "Channel Mode", |
| 3764 | .info = alc_ch_mode_info, |
| 3765 | .get = alc_ch_mode_get, |
| 3766 | .put = alc_ch_mode_put, |
| 3767 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3768 | { } /* end */ |
| 3769 | }; |
| 3770 | |
| 3771 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3772 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3773 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3774 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3775 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3776 | /* set capture source to mic-in */ |
| 3777 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3778 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3779 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3780 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3781 | /* speaker-out */ |
| 3782 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3783 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3784 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3785 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3786 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3787 | /* mic-in to input */ |
| 3788 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3789 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3790 | /* built-in mic */ |
| 3791 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3792 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3793 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3794 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3795 | { } |
| 3796 | }; |
| 3797 | |
| 3798 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3799 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3800 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3801 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3802 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3803 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3804 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3805 | } |
| 3806 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3807 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3808 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3809 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3810 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3811 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3812 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3813 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3814 | { } /* end */ |
| 3815 | }; |
| 3816 | |
| 3817 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3818 | .num_items = 2, |
| 3819 | .items = { |
| 3820 | { "Mic", 0x0 }, |
| 3821 | { "Internal Mic", 0x1 }, |
| 3822 | }, |
| 3823 | }; |
| 3824 | |
| 3825 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3826 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3827 | |
| 3828 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3829 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3830 | |
| 3831 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3832 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3833 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3834 | /* Mic2 (as headphone out) for HP output */ |
| 3835 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3836 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3837 | /* Internal Speaker */ |
| 3838 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3839 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3840 | |
| 3841 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3842 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3843 | |
| 3844 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3845 | { } |
| 3846 | }; |
| 3847 | |
| 3848 | /* toggle speaker-output according to the hp-jack state */ |
| 3849 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3850 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3851 | struct alc_spec *spec = codec->spec; |
| 3852 | alc_automute_amp(codec); |
| 3853 | /* toggle EAPD */ |
| 3854 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3855 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3856 | else |
| 3857 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3858 | } |
| 3859 | |
| 3860 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3861 | unsigned int res) |
| 3862 | { |
| 3863 | /* Looks like the unsol event is incompatible with the standard |
| 3864 | * definition. 4bit tag is placed at 28 bit! |
| 3865 | */ |
| 3866 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3867 | alc880_medion_rim_automute(codec); |
| 3868 | } |
| 3869 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3870 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3871 | { |
| 3872 | struct alc_spec *spec = codec->spec; |
| 3873 | |
| 3874 | spec->autocfg.hp_pins[0] = 0x14; |
| 3875 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3876 | } |
| 3877 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3878 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3879 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3880 | { 0x0b, HDA_INPUT, 0 }, |
| 3881 | { 0x0b, HDA_INPUT, 1 }, |
| 3882 | { 0x0b, HDA_INPUT, 2 }, |
| 3883 | { 0x0b, HDA_INPUT, 3 }, |
| 3884 | { 0x0b, HDA_INPUT, 4 }, |
| 3885 | { } /* end */ |
| 3886 | }; |
| 3887 | |
| 3888 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3889 | { 0x0b, HDA_INPUT, 1 }, |
| 3890 | { 0x0b, HDA_INPUT, 6 }, |
| 3891 | { 0x0b, HDA_INPUT, 7 }, |
| 3892 | { } /* end */ |
| 3893 | }; |
| 3894 | #endif |
| 3895 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3896 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3897 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3898 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3899 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3900 | static int alc_init(struct hda_codec *codec) |
| 3901 | { |
| 3902 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3903 | unsigned int i; |
| 3904 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3905 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3906 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3907 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3908 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3909 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3910 | |
| 3911 | if (spec->init_hook) |
| 3912 | spec->init_hook(codec); |
| 3913 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 3914 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 3915 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3916 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3917 | return 0; |
| 3918 | } |
| 3919 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3920 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3921 | { |
| 3922 | struct alc_spec *spec = codec->spec; |
| 3923 | |
| 3924 | if (spec->unsol_event) |
| 3925 | spec->unsol_event(codec, res); |
| 3926 | } |
| 3927 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3928 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3929 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3930 | { |
| 3931 | struct alc_spec *spec = codec->spec; |
| 3932 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3933 | } |
| 3934 | #endif |
| 3935 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3936 | /* |
| 3937 | * Analog playback callbacks |
| 3938 | */ |
| 3939 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3940 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3941 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3942 | { |
| 3943 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3944 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3945 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3946 | } |
| 3947 | |
| 3948 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3949 | struct hda_codec *codec, |
| 3950 | unsigned int stream_tag, |
| 3951 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3952 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3953 | { |
| 3954 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3955 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3956 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3957 | } |
| 3958 | |
| 3959 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3960 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3961 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3962 | { |
| 3963 | struct alc_spec *spec = codec->spec; |
| 3964 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3965 | } |
| 3966 | |
| 3967 | /* |
| 3968 | * Digital out |
| 3969 | */ |
| 3970 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3971 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3972 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3973 | { |
| 3974 | struct alc_spec *spec = codec->spec; |
| 3975 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3976 | } |
| 3977 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3978 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3979 | struct hda_codec *codec, |
| 3980 | unsigned int stream_tag, |
| 3981 | unsigned int format, |
| 3982 | struct snd_pcm_substream *substream) |
| 3983 | { |
| 3984 | struct alc_spec *spec = codec->spec; |
| 3985 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3986 | stream_tag, format, substream); |
| 3987 | } |
| 3988 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3989 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3990 | struct hda_codec *codec, |
| 3991 | struct snd_pcm_substream *substream) |
| 3992 | { |
| 3993 | struct alc_spec *spec = codec->spec; |
| 3994 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3995 | } |
| 3996 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3997 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3998 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3999 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4000 | { |
| 4001 | struct alc_spec *spec = codec->spec; |
| 4002 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 4003 | } |
| 4004 | |
| 4005 | /* |
| 4006 | * Analog capture |
| 4007 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4008 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4009 | struct hda_codec *codec, |
| 4010 | unsigned int stream_tag, |
| 4011 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4012 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4013 | { |
| 4014 | struct alc_spec *spec = codec->spec; |
| 4015 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4016 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4017 | stream_tag, 0, format); |
| 4018 | return 0; |
| 4019 | } |
| 4020 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4021 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 4027 | snd_hda_codec_cleanup_stream(codec, |
| 4028 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4029 | return 0; |
| 4030 | } |
| 4031 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 4032 | /* analog capture with dynamic dual-adc changes */ |
| 4033 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4034 | struct hda_codec *codec, |
| 4035 | unsigned int stream_tag, |
| 4036 | unsigned int format, |
| 4037 | struct snd_pcm_substream *substream) |
| 4038 | { |
| 4039 | struct alc_spec *spec = codec->spec; |
| 4040 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 4041 | spec->cur_adc_stream_tag = stream_tag; |
| 4042 | spec->cur_adc_format = format; |
| 4043 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 4044 | return 0; |
| 4045 | } |
| 4046 | |
| 4047 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4048 | struct hda_codec *codec, |
| 4049 | struct snd_pcm_substream *substream) |
| 4050 | { |
| 4051 | struct alc_spec *spec = codec->spec; |
| 4052 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4053 | spec->cur_adc = 0; |
| 4054 | return 0; |
| 4055 | } |
| 4056 | |
| 4057 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4058 | .substreams = 1, |
| 4059 | .channels_min = 2, |
| 4060 | .channels_max = 2, |
| 4061 | .nid = 0, /* fill later */ |
| 4062 | .ops = { |
| 4063 | .prepare = dualmic_capture_pcm_prepare, |
| 4064 | .cleanup = dualmic_capture_pcm_cleanup |
| 4065 | }, |
| 4066 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4067 | |
| 4068 | /* |
| 4069 | */ |
| 4070 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4071 | .substreams = 1, |
| 4072 | .channels_min = 2, |
| 4073 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4074 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4075 | .ops = { |
| 4076 | .open = alc880_playback_pcm_open, |
| 4077 | .prepare = alc880_playback_pcm_prepare, |
| 4078 | .cleanup = alc880_playback_pcm_cleanup |
| 4079 | }, |
| 4080 | }; |
| 4081 | |
| 4082 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4083 | .substreams = 1, |
| 4084 | .channels_min = 2, |
| 4085 | .channels_max = 2, |
| 4086 | /* NID is set in alc_build_pcms */ |
| 4087 | }; |
| 4088 | |
| 4089 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 4090 | .substreams = 1, |
| 4091 | .channels_min = 2, |
| 4092 | .channels_max = 2, |
| 4093 | /* NID is set in alc_build_pcms */ |
| 4094 | }; |
| 4095 | |
| 4096 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 4097 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4098 | .channels_min = 2, |
| 4099 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4100 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4101 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4102 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4103 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4104 | }, |
| 4105 | }; |
| 4106 | |
| 4107 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4108 | .substreams = 1, |
| 4109 | .channels_min = 2, |
| 4110 | .channels_max = 2, |
| 4111 | /* NID is set in alc_build_pcms */ |
| 4112 | .ops = { |
| 4113 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4114 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4115 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4116 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4117 | }, |
| 4118 | }; |
| 4119 | |
| 4120 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4121 | .substreams = 1, |
| 4122 | .channels_min = 2, |
| 4123 | .channels_max = 2, |
| 4124 | /* NID is set in alc_build_pcms */ |
| 4125 | }; |
| 4126 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4127 | /* 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] | 4128 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4129 | .substreams = 0, |
| 4130 | .channels_min = 0, |
| 4131 | .channels_max = 0, |
| 4132 | }; |
| 4133 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4134 | static int alc_build_pcms(struct hda_codec *codec) |
| 4135 | { |
| 4136 | struct alc_spec *spec = codec->spec; |
| 4137 | struct hda_pcm *info = spec->pcm_rec; |
| 4138 | int i; |
| 4139 | |
| 4140 | codec->num_pcms = 1; |
| 4141 | codec->pcm_info = info; |
| 4142 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4143 | if (spec->no_analog) |
| 4144 | goto skip_analog; |
| 4145 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4146 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4147 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4148 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4149 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4150 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4151 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4152 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4153 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4154 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4155 | } |
| 4156 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4157 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4158 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4159 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4160 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4161 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4162 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4163 | if (spec->channel_mode) { |
| 4164 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4165 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4166 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4167 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4168 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4169 | } |
| 4170 | } |
| 4171 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4172 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4173 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4174 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4175 | snprintf(spec->stream_name_digital, |
| 4176 | sizeof(spec->stream_name_digital), |
| 4177 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4178 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4179 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4180 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4181 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4182 | if (spec->dig_out_type) |
| 4183 | info->pcm_type = spec->dig_out_type; |
| 4184 | else |
| 4185 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4186 | if (spec->multiout.dig_out_nid && |
| 4187 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4188 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4189 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4190 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4191 | if (spec->dig_in_nid && |
| 4192 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4193 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4194 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4195 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4196 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4197 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4198 | } |
| 4199 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4200 | if (spec->no_analog) |
| 4201 | return 0; |
| 4202 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4203 | /* If the use of more than one ADC is requested for the current |
| 4204 | * model, configure a second analog capture-only PCM. |
| 4205 | */ |
| 4206 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4207 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4208 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4209 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4210 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4211 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4212 | if (spec->alt_dac_nid) { |
| 4213 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4214 | *spec->stream_analog_alt_playback; |
| 4215 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4216 | spec->alt_dac_nid; |
| 4217 | } else { |
| 4218 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4219 | alc_pcm_null_stream; |
| 4220 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4221 | } |
| 4222 | if (spec->num_adc_nids > 1) { |
| 4223 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4224 | *spec->stream_analog_alt_capture; |
| 4225 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4226 | spec->adc_nids[1]; |
| 4227 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4228 | spec->num_adc_nids - 1; |
| 4229 | } else { |
| 4230 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4231 | alc_pcm_null_stream; |
| 4232 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4233 | } |
| 4234 | } |
| 4235 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4236 | return 0; |
| 4237 | } |
| 4238 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4239 | static inline void alc_shutup(struct hda_codec *codec) |
| 4240 | { |
| 4241 | snd_hda_shutup_pins(codec); |
| 4242 | } |
| 4243 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4244 | static void alc_free_kctls(struct hda_codec *codec) |
| 4245 | { |
| 4246 | struct alc_spec *spec = codec->spec; |
| 4247 | |
| 4248 | if (spec->kctls.list) { |
| 4249 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4250 | int i; |
| 4251 | for (i = 0; i < spec->kctls.used; i++) |
| 4252 | kfree(kctl[i].name); |
| 4253 | } |
| 4254 | snd_array_free(&spec->kctls); |
| 4255 | } |
| 4256 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4257 | static void alc_free(struct hda_codec *codec) |
| 4258 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4259 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4260 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4261 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4262 | return; |
| 4263 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4264 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4265 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4266 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4267 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4268 | } |
| 4269 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4270 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4271 | static void alc_power_eapd(struct hda_codec *codec) |
| 4272 | { |
| 4273 | /* We currently only handle front, HP */ |
| 4274 | switch (codec->vendor_id) { |
| 4275 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4276 | set_eapd(codec, 0x0f, 0); |
| 4277 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4278 | break; |
| 4279 | case 0x10ec0262: |
| 4280 | case 0x10ec0267: |
| 4281 | case 0x10ec0268: |
| 4282 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4283 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4284 | case 0x10ec0272: |
| 4285 | case 0x10ec0660: |
| 4286 | case 0x10ec0662: |
| 4287 | case 0x10ec0663: |
| 4288 | case 0x10ec0862: |
| 4289 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4290 | set_eapd(codec, 0x14, 0); |
| 4291 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4292 | break; |
| 4293 | } |
| 4294 | } |
| 4295 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4296 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4297 | { |
| 4298 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4299 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4300 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4301 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4302 | return 0; |
| 4303 | } |
| 4304 | #endif |
| 4305 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4306 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4307 | static int alc_resume(struct hda_codec *codec) |
| 4308 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4309 | codec->patch_ops.init(codec); |
| 4310 | snd_hda_codec_resume_amp(codec); |
| 4311 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4312 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4313 | return 0; |
| 4314 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4315 | #endif |
| 4316 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4317 | /* |
| 4318 | */ |
| 4319 | static struct hda_codec_ops alc_patch_ops = { |
| 4320 | .build_controls = alc_build_controls, |
| 4321 | .build_pcms = alc_build_pcms, |
| 4322 | .init = alc_init, |
| 4323 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4324 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4325 | #ifdef SND_HDA_NEEDS_RESUME |
| 4326 | .resume = alc_resume, |
| 4327 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4328 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4329 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4330 | .check_power_status = alc_check_power_status, |
| 4331 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4332 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4333 | }; |
| 4334 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4335 | /* replace the codec chip_name with the given string */ |
| 4336 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4337 | { |
| 4338 | kfree(codec->chip_name); |
| 4339 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4340 | if (!codec->chip_name) { |
| 4341 | alc_free(codec); |
| 4342 | return -ENOMEM; |
| 4343 | } |
| 4344 | return 0; |
| 4345 | } |
| 4346 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4347 | /* |
| 4348 | * Test configuration for debugging |
| 4349 | * |
| 4350 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4351 | * enum controls. |
| 4352 | */ |
| 4353 | #ifdef CONFIG_SND_DEBUG |
| 4354 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4355 | 0x02, 0x03, 0x04, 0x05 |
| 4356 | }; |
| 4357 | |
| 4358 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4359 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4360 | .items = { |
| 4361 | { "In-1", 0x0 }, |
| 4362 | { "In-2", 0x1 }, |
| 4363 | { "In-3", 0x2 }, |
| 4364 | { "In-4", 0x3 }, |
| 4365 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4366 | { "Front", 0x5 }, |
| 4367 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4368 | }, |
| 4369 | }; |
| 4370 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4371 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4372 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4373 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4374 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4375 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4376 | }; |
| 4377 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4378 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4379 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4380 | { |
| 4381 | static char *texts[] = { |
| 4382 | "N/A", "Line Out", "HP Out", |
| 4383 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4384 | }; |
| 4385 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4386 | uinfo->count = 1; |
| 4387 | uinfo->value.enumerated.items = 8; |
| 4388 | if (uinfo->value.enumerated.item >= 8) |
| 4389 | uinfo->value.enumerated.item = 7; |
| 4390 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4391 | return 0; |
| 4392 | } |
| 4393 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4394 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4395 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4396 | { |
| 4397 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4398 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4399 | unsigned int pin_ctl, item = 0; |
| 4400 | |
| 4401 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4402 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4403 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4404 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4405 | item = 2; |
| 4406 | else |
| 4407 | item = 1; |
| 4408 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4409 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4410 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4411 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4412 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4413 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4414 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4415 | } |
| 4416 | } |
| 4417 | ucontrol->value.enumerated.item[0] = item; |
| 4418 | return 0; |
| 4419 | } |
| 4420 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4421 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4422 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4423 | { |
| 4424 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4425 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4426 | static unsigned int ctls[] = { |
| 4427 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4428 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4429 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4430 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4431 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4432 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4433 | }; |
| 4434 | unsigned int old_ctl, new_ctl; |
| 4435 | |
| 4436 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4437 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4438 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4439 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4440 | int val; |
| 4441 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4442 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4443 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4444 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4445 | HDA_AMP_MUTE : 0; |
| 4446 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4447 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4448 | return 1; |
| 4449 | } |
| 4450 | return 0; |
| 4451 | } |
| 4452 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4453 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4454 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4455 | { |
| 4456 | static char *texts[] = { |
| 4457 | "Front", "Surround", "CLFE", "Side" |
| 4458 | }; |
| 4459 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4460 | uinfo->count = 1; |
| 4461 | uinfo->value.enumerated.items = 4; |
| 4462 | if (uinfo->value.enumerated.item >= 4) |
| 4463 | uinfo->value.enumerated.item = 3; |
| 4464 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4465 | return 0; |
| 4466 | } |
| 4467 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4468 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4469 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4470 | { |
| 4471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4472 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4473 | unsigned int sel; |
| 4474 | |
| 4475 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4476 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4477 | return 0; |
| 4478 | } |
| 4479 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4480 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4481 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4482 | { |
| 4483 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4484 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4485 | unsigned int sel; |
| 4486 | |
| 4487 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4488 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4489 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4490 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4491 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4492 | return 1; |
| 4493 | } |
| 4494 | return 0; |
| 4495 | } |
| 4496 | |
| 4497 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4498 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4499 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4500 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4501 | .info = alc_test_pin_ctl_info, \ |
| 4502 | .get = alc_test_pin_ctl_get, \ |
| 4503 | .put = alc_test_pin_ctl_put, \ |
| 4504 | .private_value = nid \ |
| 4505 | } |
| 4506 | |
| 4507 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4508 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4509 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4510 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4511 | .info = alc_test_pin_src_info, \ |
| 4512 | .get = alc_test_pin_src_get, \ |
| 4513 | .put = alc_test_pin_src_put, \ |
| 4514 | .private_value = nid \ |
| 4515 | } |
| 4516 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4517 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4518 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4519 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4520 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4521 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4522 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4523 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4524 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4525 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4526 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4527 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4528 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4529 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4530 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4531 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4532 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4533 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4534 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4535 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4536 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4537 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4538 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4539 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4540 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4541 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4542 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4543 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4544 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4545 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4546 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4547 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4548 | { |
| 4549 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4550 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4551 | .info = alc_ch_mode_info, |
| 4552 | .get = alc_ch_mode_get, |
| 4553 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4554 | }, |
| 4555 | { } /* end */ |
| 4556 | }; |
| 4557 | |
| 4558 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4559 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4560 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4561 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4562 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4563 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4564 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4565 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4566 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4567 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4568 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4569 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4570 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4571 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4572 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4573 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4574 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4575 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4576 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4577 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4578 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4579 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4580 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4581 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4582 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4583 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4584 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4585 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4586 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4587 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4588 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4589 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4590 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4591 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4592 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4593 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4594 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4595 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4596 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4597 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4598 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4599 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4600 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4601 | /* Analog input/passthru */ |
| 4602 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4603 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4604 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4605 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4606 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4607 | { } |
| 4608 | }; |
| 4609 | #endif |
| 4610 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4611 | /* |
| 4612 | */ |
| 4613 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4614 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4615 | [ALC880_3ST] = "3stack", |
| 4616 | [ALC880_TCL_S700] = "tcl", |
| 4617 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4618 | [ALC880_CLEVO] = "clevo", |
| 4619 | [ALC880_5ST] = "5stack", |
| 4620 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4621 | [ALC880_W810] = "w810", |
| 4622 | [ALC880_Z71V] = "z71v", |
| 4623 | [ALC880_6ST] = "6stack", |
| 4624 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4625 | [ALC880_ASUS] = "asus", |
| 4626 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4627 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4628 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4629 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4630 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4631 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4632 | [ALC880_F1734] = "F1734", |
| 4633 | [ALC880_LG] = "lg", |
| 4634 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4635 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4636 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4637 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4638 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4639 | [ALC880_AUTO] = "auto", |
| 4640 | }; |
| 4641 | |
| 4642 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4643 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4644 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4645 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4646 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4647 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4648 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4649 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4650 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4651 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4652 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4653 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4654 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4655 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4656 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4657 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4658 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4659 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4660 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4661 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4662 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4663 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4664 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4665 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4666 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4667 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4668 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4669 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4670 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4671 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4672 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4673 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4674 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4675 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4676 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4677 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4678 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4679 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4680 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4681 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4682 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4683 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4684 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4685 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4686 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4687 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4688 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4689 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4690 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4691 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4692 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4693 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4694 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4695 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4696 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4697 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4698 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4699 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4700 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4701 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4702 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4703 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4704 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4705 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4706 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4707 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4708 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4709 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4710 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4711 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4712 | /* default Intel */ |
| 4713 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4714 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4715 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4716 | {} |
| 4717 | }; |
| 4718 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4719 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4720 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4721 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4722 | static struct alc_config_preset alc880_presets[] = { |
| 4723 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4724 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4725 | .init_verbs = { alc880_volume_init_verbs, |
| 4726 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4727 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4728 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4729 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4730 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4731 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4732 | .input_mux = &alc880_capture_source, |
| 4733 | }, |
| 4734 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4735 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4736 | .init_verbs = { alc880_volume_init_verbs, |
| 4737 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4738 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4739 | .dac_nids = alc880_dac_nids, |
| 4740 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4741 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4742 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4743 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4744 | .input_mux = &alc880_capture_source, |
| 4745 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4746 | [ALC880_TCL_S700] = { |
| 4747 | .mixers = { alc880_tcl_s700_mixer }, |
| 4748 | .init_verbs = { alc880_volume_init_verbs, |
| 4749 | alc880_pin_tcl_S700_init_verbs, |
| 4750 | alc880_gpio2_init_verbs }, |
| 4751 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4752 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4753 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4754 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4755 | .hp_nid = 0x03, |
| 4756 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4757 | .channel_mode = alc880_2_jack_modes, |
| 4758 | .input_mux = &alc880_capture_source, |
| 4759 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4760 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4761 | .mixers = { alc880_three_stack_mixer, |
| 4762 | alc880_five_stack_mixer}, |
| 4763 | .init_verbs = { alc880_volume_init_verbs, |
| 4764 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4765 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4766 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4767 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4768 | .channel_mode = alc880_fivestack_modes, |
| 4769 | .input_mux = &alc880_capture_source, |
| 4770 | }, |
| 4771 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4772 | .mixers = { alc880_three_stack_mixer, |
| 4773 | alc880_five_stack_mixer }, |
| 4774 | .init_verbs = { alc880_volume_init_verbs, |
| 4775 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4776 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4777 | .dac_nids = alc880_dac_nids, |
| 4778 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4779 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4780 | .channel_mode = alc880_fivestack_modes, |
| 4781 | .input_mux = &alc880_capture_source, |
| 4782 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4783 | [ALC880_6ST] = { |
| 4784 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4785 | .init_verbs = { alc880_volume_init_verbs, |
| 4786 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4787 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4788 | .dac_nids = alc880_6st_dac_nids, |
| 4789 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4790 | .channel_mode = alc880_sixstack_modes, |
| 4791 | .input_mux = &alc880_6stack_capture_source, |
| 4792 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4793 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4794 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4795 | .init_verbs = { alc880_volume_init_verbs, |
| 4796 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4797 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4798 | .dac_nids = alc880_6st_dac_nids, |
| 4799 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4800 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4801 | .channel_mode = alc880_sixstack_modes, |
| 4802 | .input_mux = &alc880_6stack_capture_source, |
| 4803 | }, |
| 4804 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4805 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4806 | .init_verbs = { alc880_volume_init_verbs, |
| 4807 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4808 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4809 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4810 | .dac_nids = alc880_w810_dac_nids, |
| 4811 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4812 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4813 | .channel_mode = alc880_w810_modes, |
| 4814 | .input_mux = &alc880_capture_source, |
| 4815 | }, |
| 4816 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4817 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4818 | .init_verbs = { alc880_volume_init_verbs, |
| 4819 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4820 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4821 | .dac_nids = alc880_z71v_dac_nids, |
| 4822 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4823 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4824 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4825 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4826 | .input_mux = &alc880_capture_source, |
| 4827 | }, |
| 4828 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4829 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4830 | .init_verbs = { alc880_volume_init_verbs, |
| 4831 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4832 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4833 | .dac_nids = alc880_f1734_dac_nids, |
| 4834 | .hp_nid = 0x02, |
| 4835 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4836 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4837 | .input_mux = &alc880_f1734_capture_source, |
| 4838 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4839 | .setup = alc880_uniwill_p53_setup, |
| 4840 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4841 | }, |
| 4842 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4843 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4844 | .init_verbs = { alc880_volume_init_verbs, |
| 4845 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4846 | alc880_gpio1_init_verbs }, |
| 4847 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4848 | .dac_nids = alc880_asus_dac_nids, |
| 4849 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4850 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4851 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4852 | .input_mux = &alc880_capture_source, |
| 4853 | }, |
| 4854 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4855 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4856 | .init_verbs = { alc880_volume_init_verbs, |
| 4857 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4858 | alc880_gpio1_init_verbs }, |
| 4859 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4860 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4861 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4862 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4863 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4864 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4865 | .input_mux = &alc880_capture_source, |
| 4866 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4867 | [ALC880_ASUS_DIG2] = { |
| 4868 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4869 | .init_verbs = { alc880_volume_init_verbs, |
| 4870 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4871 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4872 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4873 | .dac_nids = alc880_asus_dac_nids, |
| 4874 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4875 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4876 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4877 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4878 | .input_mux = &alc880_capture_source, |
| 4879 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4880 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4881 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4882 | .init_verbs = { alc880_volume_init_verbs, |
| 4883 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4884 | alc880_gpio1_init_verbs }, |
| 4885 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4886 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4887 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4888 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4889 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4890 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4891 | .input_mux = &alc880_capture_source, |
| 4892 | }, |
| 4893 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4894 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4895 | .init_verbs = { alc880_volume_init_verbs, |
| 4896 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4897 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4898 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4899 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4900 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4901 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4902 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4903 | .input_mux = &alc880_capture_source, |
| 4904 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4905 | [ALC880_UNIWILL] = { |
| 4906 | .mixers = { alc880_uniwill_mixer }, |
| 4907 | .init_verbs = { alc880_volume_init_verbs, |
| 4908 | alc880_uniwill_init_verbs }, |
| 4909 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4910 | .dac_nids = alc880_asus_dac_nids, |
| 4911 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4912 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4913 | .channel_mode = alc880_threestack_modes, |
| 4914 | .need_dac_fix = 1, |
| 4915 | .input_mux = &alc880_capture_source, |
| 4916 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4917 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4918 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4919 | }, |
| 4920 | [ALC880_UNIWILL_P53] = { |
| 4921 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4922 | .init_verbs = { alc880_volume_init_verbs, |
| 4923 | alc880_uniwill_p53_init_verbs }, |
| 4924 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4925 | .dac_nids = alc880_asus_dac_nids, |
| 4926 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4927 | .channel_mode = alc880_threestack_modes, |
| 4928 | .input_mux = &alc880_capture_source, |
| 4929 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4930 | .setup = alc880_uniwill_p53_setup, |
| 4931 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4932 | }, |
| 4933 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4934 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4935 | .init_verbs = { alc880_volume_init_verbs, |
| 4936 | alc880_uniwill_p53_init_verbs, |
| 4937 | alc880_beep_init_verbs }, |
| 4938 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4939 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4940 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4941 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4942 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4943 | .input_mux = &alc880_capture_source, |
| 4944 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4945 | .setup = alc880_uniwill_p53_setup, |
| 4946 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4947 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4948 | [ALC880_CLEVO] = { |
| 4949 | .mixers = { alc880_three_stack_mixer }, |
| 4950 | .init_verbs = { alc880_volume_init_verbs, |
| 4951 | alc880_pin_clevo_init_verbs }, |
| 4952 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4953 | .dac_nids = alc880_dac_nids, |
| 4954 | .hp_nid = 0x03, |
| 4955 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4956 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4957 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4958 | .input_mux = &alc880_capture_source, |
| 4959 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4960 | [ALC880_LG] = { |
| 4961 | .mixers = { alc880_lg_mixer }, |
| 4962 | .init_verbs = { alc880_volume_init_verbs, |
| 4963 | alc880_lg_init_verbs }, |
| 4964 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4965 | .dac_nids = alc880_lg_dac_nids, |
| 4966 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4967 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4968 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4969 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4970 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4971 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4972 | .setup = alc880_lg_setup, |
| 4973 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4974 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4975 | .loopbacks = alc880_lg_loopbacks, |
| 4976 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4977 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4978 | [ALC880_LG_LW] = { |
| 4979 | .mixers = { alc880_lg_lw_mixer }, |
| 4980 | .init_verbs = { alc880_volume_init_verbs, |
| 4981 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4982 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4983 | .dac_nids = alc880_dac_nids, |
| 4984 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4985 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4986 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4987 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4988 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4989 | .setup = alc880_lg_lw_setup, |
| 4990 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4991 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4992 | [ALC880_MEDION_RIM] = { |
| 4993 | .mixers = { alc880_medion_rim_mixer }, |
| 4994 | .init_verbs = { alc880_volume_init_verbs, |
| 4995 | alc880_medion_rim_init_verbs, |
| 4996 | alc_gpio2_init_verbs }, |
| 4997 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4998 | .dac_nids = alc880_dac_nids, |
| 4999 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5000 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5001 | .channel_mode = alc880_2_jack_modes, |
| 5002 | .input_mux = &alc880_medion_rim_capture_source, |
| 5003 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5004 | .setup = alc880_medion_rim_setup, |
| 5005 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5006 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5007 | #ifdef CONFIG_SND_DEBUG |
| 5008 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5009 | .mixers = { alc880_test_mixer }, |
| 5010 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5011 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 5012 | .dac_nids = alc880_test_dac_nids, |
| 5013 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5014 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 5015 | .channel_mode = alc880_test_modes, |
| 5016 | .input_mux = &alc880_test_capture_source, |
| 5017 | }, |
| 5018 | #endif |
| 5019 | }; |
| 5020 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5021 | /* |
| 5022 | * Automatic parse of I/O pins from the BIOS configuration |
| 5023 | */ |
| 5024 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5025 | enum { |
| 5026 | ALC_CTL_WIDGET_VOL, |
| 5027 | ALC_CTL_WIDGET_MUTE, |
| 5028 | ALC_CTL_BIND_MUTE, |
| 5029 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5030 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5031 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 5032 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5033 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5034 | }; |
| 5035 | |
| 5036 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5037 | 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] | 5038 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5039 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5040 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5041 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5042 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 5043 | knew = snd_array_new(&spec->kctls); |
| 5044 | if (!knew) |
| 5045 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5046 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5047 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5048 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5049 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5050 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5051 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5052 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5053 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5054 | return 0; |
| 5055 | } |
| 5056 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5057 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5058 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5059 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5060 | { |
| 5061 | char name[32]; |
| 5062 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5063 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5064 | } |
| 5065 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5066 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5067 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5068 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5069 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5070 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5071 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5072 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5073 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5074 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5075 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5076 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5077 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5078 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5079 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5080 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5081 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5082 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5083 | #define ALC880_PIN_CD_NID 0x1c |
| 5084 | |
| 5085 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5086 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5087 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5088 | { |
| 5089 | hda_nid_t nid; |
| 5090 | int assigned[4]; |
| 5091 | int i, j; |
| 5092 | |
| 5093 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5094 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5095 | |
| 5096 | /* check the pins hardwired to audio widget */ |
| 5097 | for (i = 0; i < cfg->line_outs; i++) { |
| 5098 | nid = cfg->line_out_pins[i]; |
| 5099 | if (alc880_is_fixed_pin(nid)) { |
| 5100 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5101 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5102 | assigned[idx] = 1; |
| 5103 | } |
| 5104 | } |
| 5105 | /* left pins can be connect to any audio widget */ |
| 5106 | for (i = 0; i < cfg->line_outs; i++) { |
| 5107 | nid = cfg->line_out_pins[i]; |
| 5108 | if (alc880_is_fixed_pin(nid)) |
| 5109 | continue; |
| 5110 | /* search for an empty channel */ |
| 5111 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5112 | if (!assigned[j]) { |
| 5113 | spec->multiout.dac_nids[i] = |
| 5114 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5115 | assigned[j] = 1; |
| 5116 | break; |
| 5117 | } |
| 5118 | } |
| 5119 | } |
| 5120 | spec->multiout.num_dacs = cfg->line_outs; |
| 5121 | return 0; |
| 5122 | } |
| 5123 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5124 | static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg, |
| 5125 | bool can_be_master) |
| 5126 | { |
| 5127 | if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
| 5128 | return "Master"; |
| 5129 | |
| 5130 | switch (cfg->line_out_type) { |
| 5131 | case AUTO_PIN_SPEAKER_OUT: |
| 5132 | return "Speaker"; |
| 5133 | case AUTO_PIN_HP_OUT: |
| 5134 | return "Headphone"; |
| 5135 | default: |
| 5136 | if (cfg->line_outs == 1) |
| 5137 | return "PCM"; |
| 5138 | break; |
| 5139 | } |
| 5140 | return NULL; |
| 5141 | } |
| 5142 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5143 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5144 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5145 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5146 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5147 | static const char *chname[4] = { |
| 5148 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5149 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5150 | const char *pfx = alc_get_line_out_pfx(cfg, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5151 | hda_nid_t nid; |
| 5152 | int i, err; |
| 5153 | |
| 5154 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5155 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5156 | continue; |
| 5157 | 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] | 5158 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5159 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5160 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5161 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5162 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5163 | HDA_OUTPUT)); |
| 5164 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5165 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5166 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5167 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5168 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5169 | HDA_OUTPUT)); |
| 5170 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5171 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5172 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5173 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5174 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5175 | HDA_INPUT)); |
| 5176 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5177 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5178 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5179 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5180 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5181 | HDA_INPUT)); |
| 5182 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5183 | return err; |
| 5184 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5185 | const char *name = pfx; |
| 5186 | if (!name) |
| 5187 | name = chname[i]; |
| 5188 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5189 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5190 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5191 | HDA_OUTPUT)); |
| 5192 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5193 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5194 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5195 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5196 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5197 | HDA_INPUT)); |
| 5198 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5199 | return err; |
| 5200 | } |
| 5201 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5202 | return 0; |
| 5203 | } |
| 5204 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5205 | /* add playback controls for speaker and HP outputs */ |
| 5206 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5207 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5208 | { |
| 5209 | hda_nid_t nid; |
| 5210 | int err; |
| 5211 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5212 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5213 | return 0; |
| 5214 | |
| 5215 | if (alc880_is_fixed_pin(pin)) { |
| 5216 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5217 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5218 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5219 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5220 | else |
| 5221 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5222 | /* control HP volume/switch on the output mixer amp */ |
| 5223 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5224 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5225 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5226 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5227 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5228 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5229 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5230 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5231 | return err; |
| 5232 | } else if (alc880_is_multi_pin(pin)) { |
| 5233 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5234 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5235 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5236 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5237 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5238 | return err; |
| 5239 | } |
| 5240 | return 0; |
| 5241 | } |
| 5242 | |
| 5243 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5244 | 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] | 5245 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5246 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5247 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5248 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5249 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5250 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5251 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5252 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5253 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5254 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5255 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5256 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5257 | return err; |
| 5258 | return 0; |
| 5259 | } |
| 5260 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5261 | 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] | 5262 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5263 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5264 | return (pincap & AC_PINCAP_IN) != 0; |
| 5265 | } |
| 5266 | |
| 5267 | /* create playback/capture controls for input pins */ |
| 5268 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5269 | const struct auto_pin_cfg *cfg, |
| 5270 | hda_nid_t mixer, |
| 5271 | hda_nid_t cap1, hda_nid_t cap2) |
| 5272 | { |
| 5273 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5274 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5275 | int i, err, idx, type_idx = 0; |
| 5276 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5277 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5278 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5279 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5280 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5281 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5282 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5283 | if (!alc_is_input_pin(codec, pin)) |
| 5284 | continue; |
| 5285 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5286 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5287 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5288 | type_idx++; |
| 5289 | else |
| 5290 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5291 | prev_label = label; |
| 5292 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5293 | if (mixer) { |
| 5294 | idx = get_connection_index(codec, mixer, pin); |
| 5295 | if (idx >= 0) { |
| 5296 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5297 | label, type_idx, |
| 5298 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5299 | if (err < 0) |
| 5300 | return err; |
| 5301 | } |
| 5302 | } |
| 5303 | |
| 5304 | if (!cap1) |
| 5305 | continue; |
| 5306 | idx = get_connection_index(codec, cap1, pin); |
| 5307 | if (idx < 0 && cap2) |
| 5308 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5309 | if (idx >= 0) |
| 5310 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5311 | } |
| 5312 | return 0; |
| 5313 | } |
| 5314 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5315 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5316 | const struct auto_pin_cfg *cfg) |
| 5317 | { |
| 5318 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5319 | } |
| 5320 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5321 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5322 | unsigned int pin_type) |
| 5323 | { |
| 5324 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5325 | pin_type); |
| 5326 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5327 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5328 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5329 | } |
| 5330 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5331 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5332 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5333 | int dac_idx) |
| 5334 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5335 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5336 | /* need the manual connection? */ |
| 5337 | if (alc880_is_multi_pin(nid)) { |
| 5338 | struct alc_spec *spec = codec->spec; |
| 5339 | int idx = alc880_multi_pin_idx(nid); |
| 5340 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5341 | AC_VERB_SET_CONNECT_SEL, |
| 5342 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5343 | } |
| 5344 | } |
| 5345 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5346 | static int get_pin_type(int line_out_type) |
| 5347 | { |
| 5348 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5349 | return PIN_HP; |
| 5350 | else |
| 5351 | return PIN_OUT; |
| 5352 | } |
| 5353 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5354 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5355 | { |
| 5356 | struct alc_spec *spec = codec->spec; |
| 5357 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5358 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5359 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5360 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5361 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5362 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5363 | } |
| 5364 | } |
| 5365 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5366 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5367 | { |
| 5368 | struct alc_spec *spec = codec->spec; |
| 5369 | hda_nid_t pin; |
| 5370 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5371 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5372 | if (pin) /* connect to front */ |
| 5373 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5374 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5375 | if (pin) /* connect to front */ |
| 5376 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5377 | } |
| 5378 | |
| 5379 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5380 | { |
| 5381 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5382 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5383 | int i; |
| 5384 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5385 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5386 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5387 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5388 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5389 | if (nid != ALC880_PIN_CD_NID && |
| 5390 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5391 | snd_hda_codec_write(codec, nid, 0, |
| 5392 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5393 | AMP_OUT_MUTE); |
| 5394 | } |
| 5395 | } |
| 5396 | } |
| 5397 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5398 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5399 | { |
| 5400 | struct alc_spec *spec = codec->spec; |
| 5401 | int c; |
| 5402 | |
| 5403 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5404 | unsigned int mux_idx; |
| 5405 | const struct hda_input_mux *imux; |
| 5406 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5407 | imux = &spec->input_mux[mux_idx]; |
| 5408 | if (!imux->num_items && mux_idx > 0) |
| 5409 | imux = &spec->input_mux[0]; |
| 5410 | if (imux) |
| 5411 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5412 | AC_VERB_SET_CONNECT_SEL, |
| 5413 | imux->items[0].index); |
| 5414 | } |
| 5415 | } |
| 5416 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5417 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5418 | /* return 1 if successful, 0 if the proper config is not found, |
| 5419 | * or a negative error code |
| 5420 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5421 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5422 | { |
| 5423 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5424 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5425 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5426 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5427 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5428 | alc880_ignore); |
| 5429 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5430 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5431 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5432 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5433 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5434 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5435 | if (err < 0) |
| 5436 | return err; |
| 5437 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5438 | if (err < 0) |
| 5439 | return err; |
| 5440 | err = alc880_auto_create_extra_out(spec, |
| 5441 | spec->autocfg.speaker_pins[0], |
| 5442 | "Speaker"); |
| 5443 | if (err < 0) |
| 5444 | return err; |
| 5445 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5446 | "Headphone"); |
| 5447 | if (err < 0) |
| 5448 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5449 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5450 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5451 | return err; |
| 5452 | |
| 5453 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5454 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5455 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5456 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5457 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5458 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5459 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5460 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5461 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5462 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5463 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5464 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5465 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5466 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5467 | return 1; |
| 5468 | } |
| 5469 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5470 | /* additional initialization for auto-configuration model */ |
| 5471 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5472 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5473 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5474 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5475 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5476 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5477 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5478 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5479 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5480 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5481 | } |
| 5482 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5483 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5484 | * one of two digital mic pins, e.g. on ALC272 |
| 5485 | */ |
| 5486 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5487 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5488 | struct alc_spec *spec = codec->spec; |
| 5489 | int i; |
| 5490 | |
| 5491 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5492 | hda_nid_t cap = spec->capsrc_nids ? |
| 5493 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5494 | int iidx, eidx; |
| 5495 | |
| 5496 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5497 | if (iidx < 0) |
| 5498 | continue; |
| 5499 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5500 | if (eidx < 0) |
| 5501 | continue; |
| 5502 | spec->int_mic.mux_idx = iidx; |
| 5503 | spec->ext_mic.mux_idx = eidx; |
| 5504 | if (spec->capsrc_nids) |
| 5505 | spec->capsrc_nids += i; |
| 5506 | spec->adc_nids += i; |
| 5507 | spec->num_adc_nids = 1; |
| 5508 | return; |
| 5509 | } |
| 5510 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5511 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5512 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5513 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5514 | } |
| 5515 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5516 | /* select or unmute the given capsrc route */ |
| 5517 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5518 | int idx) |
| 5519 | { |
| 5520 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5521 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5522 | HDA_AMP_MUTE, 0); |
| 5523 | } else { |
| 5524 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5525 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5526 | } |
| 5527 | } |
| 5528 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5529 | /* set the default connection to that pin */ |
| 5530 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5531 | { |
| 5532 | struct alc_spec *spec = codec->spec; |
| 5533 | int i; |
| 5534 | |
| 5535 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5536 | hda_nid_t cap = spec->capsrc_nids ? |
| 5537 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5538 | int idx; |
| 5539 | |
| 5540 | idx = get_connection_index(codec, cap, pin); |
| 5541 | if (idx < 0) |
| 5542 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5543 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5544 | return i; /* return the found index */ |
| 5545 | } |
| 5546 | return -1; /* not found */ |
| 5547 | } |
| 5548 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5549 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5550 | static void fixup_single_adc(struct hda_codec *codec) |
| 5551 | { |
| 5552 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5553 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5554 | int i; |
| 5555 | |
| 5556 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5557 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5558 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5559 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5560 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5561 | /* use only this ADC */ |
| 5562 | if (spec->capsrc_nids) |
| 5563 | spec->capsrc_nids += i; |
| 5564 | spec->adc_nids += i; |
| 5565 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5566 | } |
| 5567 | } |
| 5568 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5569 | /* initialize dual adcs */ |
| 5570 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5571 | { |
| 5572 | struct alc_spec *spec = codec->spec; |
| 5573 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5574 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5575 | } |
| 5576 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5577 | static void set_capture_mixer(struct hda_codec *codec) |
| 5578 | { |
| 5579 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5580 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5581 | { alc_capture_mixer_nosrc1, |
| 5582 | alc_capture_mixer_nosrc2, |
| 5583 | alc_capture_mixer_nosrc3 }, |
| 5584 | { alc_capture_mixer1, |
| 5585 | alc_capture_mixer2, |
| 5586 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5587 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5588 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5589 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5590 | int num_adcs = spec->num_adc_nids; |
| 5591 | if (spec->dual_adc_switch) |
| 5592 | fixup_dual_adc_switch(codec); |
| 5593 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5594 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5595 | else if (spec->input_mux) { |
| 5596 | if (spec->input_mux->num_items > 1) |
| 5597 | mux = 1; |
| 5598 | else if (spec->input_mux->num_items == 1) |
| 5599 | fixup_single_adc(codec); |
| 5600 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5601 | if (spec->dual_adc_switch) |
| 5602 | num_adcs = 1; |
| 5603 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5604 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5605 | } |
| 5606 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5607 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5608 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5609 | int num_nids) |
| 5610 | { |
| 5611 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5612 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5613 | int n; |
| 5614 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5615 | |
| 5616 | for (n = 0; n < num_nids; n++) { |
| 5617 | hda_nid_t adc, cap; |
| 5618 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5619 | int nconns, i, j; |
| 5620 | |
| 5621 | adc = nids[n]; |
| 5622 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5623 | continue; |
| 5624 | cap = adc; |
| 5625 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5626 | ARRAY_SIZE(conn)); |
| 5627 | if (nconns == 1) { |
| 5628 | cap = conn[0]; |
| 5629 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5630 | ARRAY_SIZE(conn)); |
| 5631 | } |
| 5632 | if (nconns <= 0) |
| 5633 | continue; |
| 5634 | if (!fallback_adc) { |
| 5635 | fallback_adc = adc; |
| 5636 | fallback_cap = cap; |
| 5637 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5638 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5639 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5640 | for (j = 0; j < nconns; j++) { |
| 5641 | if (conn[j] == nid) |
| 5642 | break; |
| 5643 | } |
| 5644 | if (j >= nconns) |
| 5645 | break; |
| 5646 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5647 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5648 | int num_adcs = spec->num_adc_nids; |
| 5649 | spec->private_adc_nids[num_adcs] = adc; |
| 5650 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5651 | spec->num_adc_nids++; |
| 5652 | spec->adc_nids = spec->private_adc_nids; |
| 5653 | if (adc != cap) |
| 5654 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5655 | } |
| 5656 | } |
| 5657 | if (!spec->num_adc_nids) { |
| 5658 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5659 | " using fallback 0x%x\n", |
| 5660 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5661 | spec->private_adc_nids[0] = fallback_adc; |
| 5662 | spec->adc_nids = spec->private_adc_nids; |
| 5663 | if (fallback_adc != fallback_cap) { |
| 5664 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5665 | spec->capsrc_nids = spec->private_adc_nids; |
| 5666 | } |
| 5667 | } |
| 5668 | } |
| 5669 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5670 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5671 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5672 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5673 | |
| 5674 | static struct snd_pci_quirk beep_white_list[] = { |
| 5675 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5676 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5677 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5678 | {} |
| 5679 | }; |
| 5680 | |
| 5681 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5682 | { |
| 5683 | struct alc_spec *spec = codec->spec; |
| 5684 | const struct snd_pci_quirk *q; |
| 5685 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5686 | if (q) |
| 5687 | return q->value; |
| 5688 | return spec->cdefine.enable_pcbeep; |
| 5689 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5690 | #else |
| 5691 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5692 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5693 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5694 | |
| 5695 | /* |
| 5696 | * OK, here we have finally the patch for ALC880 |
| 5697 | */ |
| 5698 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5699 | static int patch_alc880(struct hda_codec *codec) |
| 5700 | { |
| 5701 | struct alc_spec *spec; |
| 5702 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5703 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5704 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5705 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5706 | if (spec == NULL) |
| 5707 | return -ENOMEM; |
| 5708 | |
| 5709 | codec->spec = spec; |
| 5710 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5711 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5712 | alc880_models, |
| 5713 | alc880_cfg_tbl); |
| 5714 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5715 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5716 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5717 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5718 | } |
| 5719 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5720 | if (board_config == ALC880_AUTO) { |
| 5721 | /* automatic parse from the BIOS config */ |
| 5722 | err = alc880_parse_auto_config(codec); |
| 5723 | if (err < 0) { |
| 5724 | alc_free(codec); |
| 5725 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5726 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5727 | printk(KERN_INFO |
| 5728 | "hda_codec: Cannot set up configuration " |
| 5729 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5730 | board_config = ALC880_3ST; |
| 5731 | } |
| 5732 | } |
| 5733 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5734 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5735 | if (err < 0) { |
| 5736 | alc_free(codec); |
| 5737 | return err; |
| 5738 | } |
| 5739 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5740 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5741 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5742 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5743 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5744 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5745 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5746 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5747 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5748 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5749 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5750 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5751 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5752 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5753 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5754 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5755 | if (wcap != AC_WID_AUD_IN) { |
| 5756 | spec->adc_nids = alc880_adc_nids_alt; |
| 5757 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5758 | } else { |
| 5759 | spec->adc_nids = alc880_adc_nids; |
| 5760 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5761 | } |
| 5762 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5763 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5764 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5765 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5766 | spec->vmaster_nid = 0x0c; |
| 5767 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5768 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5769 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5770 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5771 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5772 | if (!spec->loopback.amplist) |
| 5773 | spec->loopback.amplist = alc880_loopbacks; |
| 5774 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5775 | |
| 5776 | return 0; |
| 5777 | } |
| 5778 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5779 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5780 | /* |
| 5781 | * ALC260 support |
| 5782 | */ |
| 5783 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5784 | static hda_nid_t alc260_dac_nids[1] = { |
| 5785 | /* front */ |
| 5786 | 0x02, |
| 5787 | }; |
| 5788 | |
| 5789 | static hda_nid_t alc260_adc_nids[1] = { |
| 5790 | /* ADC0 */ |
| 5791 | 0x04, |
| 5792 | }; |
| 5793 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5794 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5795 | /* ADC1 */ |
| 5796 | 0x05, |
| 5797 | }; |
| 5798 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5799 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5800 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5801 | */ |
| 5802 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5803 | /* ADC0, ADC1 */ |
| 5804 | 0x04, 0x05 |
| 5805 | }; |
| 5806 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5807 | #define ALC260_DIGOUT_NID 0x03 |
| 5808 | #define ALC260_DIGIN_NID 0x06 |
| 5809 | |
| 5810 | static struct hda_input_mux alc260_capture_source = { |
| 5811 | .num_items = 4, |
| 5812 | .items = { |
| 5813 | { "Mic", 0x0 }, |
| 5814 | { "Front Mic", 0x1 }, |
| 5815 | { "Line", 0x2 }, |
| 5816 | { "CD", 0x4 }, |
| 5817 | }, |
| 5818 | }; |
| 5819 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5820 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5821 | * headphone jack and the internal CD lines since these are the only pins at |
| 5822 | * which audio can appear. For flexibility, also allow the option of |
| 5823 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5824 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5825 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5826 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5827 | { |
| 5828 | .num_items = 3, |
| 5829 | .items = { |
| 5830 | { "Mic/Line", 0x0 }, |
| 5831 | { "CD", 0x4 }, |
| 5832 | { "Headphone", 0x2 }, |
| 5833 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5834 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5835 | { |
| 5836 | .num_items = 4, |
| 5837 | .items = { |
| 5838 | { "Mic/Line", 0x0 }, |
| 5839 | { "CD", 0x4 }, |
| 5840 | { "Headphone", 0x2 }, |
| 5841 | { "Mixer", 0x5 }, |
| 5842 | }, |
| 5843 | }, |
| 5844 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5845 | }; |
| 5846 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5847 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5848 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5849 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5850 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5851 | { |
| 5852 | .num_items = 4, |
| 5853 | .items = { |
| 5854 | { "Mic", 0x0 }, |
| 5855 | { "Line", 0x2 }, |
| 5856 | { "CD", 0x4 }, |
| 5857 | { "Headphone", 0x5 }, |
| 5858 | }, |
| 5859 | }, |
| 5860 | { |
| 5861 | .num_items = 5, |
| 5862 | .items = { |
| 5863 | { "Mic", 0x0 }, |
| 5864 | { "Line", 0x2 }, |
| 5865 | { "CD", 0x4 }, |
| 5866 | { "Headphone", 0x6 }, |
| 5867 | { "Mixer", 0x5 }, |
| 5868 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5869 | }, |
| 5870 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5871 | |
| 5872 | /* Maxdata Favorit 100XS */ |
| 5873 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5874 | { |
| 5875 | .num_items = 2, |
| 5876 | .items = { |
| 5877 | { "Line/Mic", 0x0 }, |
| 5878 | { "CD", 0x4 }, |
| 5879 | }, |
| 5880 | }, |
| 5881 | { |
| 5882 | .num_items = 3, |
| 5883 | .items = { |
| 5884 | { "Line/Mic", 0x0 }, |
| 5885 | { "CD", 0x4 }, |
| 5886 | { "Mixer", 0x5 }, |
| 5887 | }, |
| 5888 | }, |
| 5889 | }; |
| 5890 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5891 | /* |
| 5892 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5893 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5894 | * element which allows changing the channel mode, so the verb list is |
| 5895 | * never used. |
| 5896 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5897 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5898 | { 2, NULL }, |
| 5899 | }; |
| 5900 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5901 | |
| 5902 | /* Mixer combinations |
| 5903 | * |
| 5904 | * basic: base_output + input + pc_beep + capture |
| 5905 | * HP: base_output + input + capture_alt |
| 5906 | * HP_3013: hp_3013 + input + capture |
| 5907 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5908 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5909 | */ |
| 5910 | |
| 5911 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5912 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5913 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5914 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5915 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5916 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5917 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5918 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5919 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5920 | |
| 5921 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5922 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5923 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5924 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5925 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5926 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5927 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5928 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5929 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5930 | { } /* end */ |
| 5931 | }; |
| 5932 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5933 | /* update HP, line and mono out pins according to the master switch */ |
| 5934 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5935 | hda_nid_t hp, hda_nid_t line, |
| 5936 | hda_nid_t mono) |
| 5937 | { |
| 5938 | struct alc_spec *spec = codec->spec; |
| 5939 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5940 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5941 | 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] | 5942 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5943 | 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] | 5944 | val); |
| 5945 | /* mono (speaker) depending on the HP jack sense */ |
| 5946 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5947 | 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] | 5948 | val); |
| 5949 | } |
| 5950 | |
| 5951 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5952 | struct snd_ctl_elem_value *ucontrol) |
| 5953 | { |
| 5954 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5955 | struct alc_spec *spec = codec->spec; |
| 5956 | *ucontrol->value.integer.value = spec->master_sw; |
| 5957 | return 0; |
| 5958 | } |
| 5959 | |
| 5960 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5961 | struct snd_ctl_elem_value *ucontrol) |
| 5962 | { |
| 5963 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5964 | struct alc_spec *spec = codec->spec; |
| 5965 | int val = !!*ucontrol->value.integer.value; |
| 5966 | hda_nid_t hp, line, mono; |
| 5967 | |
| 5968 | if (val == spec->master_sw) |
| 5969 | return 0; |
| 5970 | spec->master_sw = val; |
| 5971 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5972 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5973 | mono = kcontrol->private_value & 0xff; |
| 5974 | alc260_hp_master_update(codec, hp, line, mono); |
| 5975 | return 1; |
| 5976 | } |
| 5977 | |
| 5978 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5979 | { |
| 5980 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5981 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5982 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5983 | .info = snd_ctl_boolean_mono_info, |
| 5984 | .get = alc260_hp_master_sw_get, |
| 5985 | .put = alc260_hp_master_sw_put, |
| 5986 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5987 | }, |
| 5988 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5989 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5990 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5991 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5992 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5993 | HDA_OUTPUT), |
| 5994 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5995 | { } /* end */ |
| 5996 | }; |
| 5997 | |
| 5998 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5999 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6000 | {}, |
| 6001 | }; |
| 6002 | |
| 6003 | static void alc260_hp_automute(struct hda_codec *codec) |
| 6004 | { |
| 6005 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6006 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6007 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6008 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 6009 | } |
| 6010 | |
| 6011 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6012 | { |
| 6013 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6014 | alc260_hp_automute(codec); |
| 6015 | } |
| 6016 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6017 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6018 | { |
| 6019 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6020 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6021 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6022 | .info = snd_ctl_boolean_mono_info, |
| 6023 | .get = alc260_hp_master_sw_get, |
| 6024 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6025 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6026 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6027 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6028 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6029 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6030 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6031 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6032 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6033 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6034 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6035 | { } /* end */ |
| 6036 | }; |
| 6037 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6038 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 6039 | .ops = &snd_hda_bind_vol, |
| 6040 | .values = { |
| 6041 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6042 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6043 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6044 | 0 |
| 6045 | }, |
| 6046 | }; |
| 6047 | |
| 6048 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 6049 | .ops = &snd_hda_bind_sw, |
| 6050 | .values = { |
| 6051 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6052 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6053 | 0 |
| 6054 | }, |
| 6055 | }; |
| 6056 | |
| 6057 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 6058 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6059 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6060 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6061 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6062 | { } /* end */ |
| 6063 | }; |
| 6064 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6065 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 6066 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6067 | {}, |
| 6068 | }; |
| 6069 | |
| 6070 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 6071 | { |
| 6072 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6073 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6074 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6075 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6076 | } |
| 6077 | |
| 6078 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 6079 | unsigned int res) |
| 6080 | { |
| 6081 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6082 | alc260_hp_3013_automute(codec); |
| 6083 | } |
| 6084 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6085 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 6086 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6087 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6088 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6089 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6090 | bits); |
| 6091 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6092 | bits); |
| 6093 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6094 | bits); |
| 6095 | } |
| 6096 | |
| 6097 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 6098 | unsigned int res) |
| 6099 | { |
| 6100 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6101 | alc260_hp_3012_automute(codec); |
| 6102 | } |
| 6103 | |
| 6104 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6105 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6106 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6107 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6108 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6109 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6110 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6111 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6112 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6113 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6114 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6115 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6116 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6117 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6118 | { } /* end */ |
| 6119 | }; |
| 6120 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6121 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6122 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6123 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6124 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6125 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6126 | * revisions available in early 2006. Therefore for now allow the |
| 6127 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6128 | * that the lack of mic bias for this NID is intentional we could change the |
| 6129 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6130 | * |
| 6131 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6132 | * don't appear to make the mic bias available from the "line" jack, even |
| 6133 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6134 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6135 | * and the output jack. If this turns out to be the case for all such |
| 6136 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6137 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6138 | * |
| 6139 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6140 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6141 | * controls for such models. On models without a "mono speaker" the control |
| 6142 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6143 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6144 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6145 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6146 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6147 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6148 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6149 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6150 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6151 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6152 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6153 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6154 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6155 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6156 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6157 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6158 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6159 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6160 | { } /* end */ |
| 6161 | }; |
| 6162 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6163 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6164 | */ |
| 6165 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6166 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6167 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6168 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6169 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6170 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6171 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6172 | { } /* end */ |
| 6173 | }; |
| 6174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6175 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6176 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6177 | */ |
| 6178 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6179 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6180 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6181 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6183 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6184 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6185 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6186 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6187 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6188 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6189 | { } /* end */ |
| 6190 | }; |
| 6191 | |
| 6192 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6193 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6194 | */ |
| 6195 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6196 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6197 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6200 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6201 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6202 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6203 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6204 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6205 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6206 | { } /* end */ |
| 6207 | }; |
| 6208 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6209 | /* |
| 6210 | * initialization verbs |
| 6211 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6212 | static struct hda_verb alc260_init_verbs[] = { |
| 6213 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6214 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6215 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6216 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6217 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6218 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6219 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6220 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6221 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6222 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6223 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6224 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6225 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6226 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6227 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6228 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6229 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6230 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6231 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6232 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6233 | /* set connection select to line in (default select for this ADC) */ |
| 6234 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6235 | /* mute capture amp left and right */ |
| 6236 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6237 | /* set connection select to line in (default select for this ADC) */ |
| 6238 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6239 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6240 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6241 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6242 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6243 | /* set vol=0 HP mixer amp left and right */ |
| 6244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6245 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6246 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6247 | /* set vol=0 Mono mixer amp left and right */ |
| 6248 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6249 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6250 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6251 | /* unmute LINE-2 out pin */ |
| 6252 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6253 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6254 | * Line In 2 = 0x03 |
| 6255 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6256 | /* mute analog inputs */ |
| 6257 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6258 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6259 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6260 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6261 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6262 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6263 | /* mute Front out path */ |
| 6264 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6265 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6266 | /* mute Headphone out path */ |
| 6267 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6268 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6269 | /* mute Mono out path */ |
| 6270 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6271 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6272 | { } |
| 6273 | }; |
| 6274 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6275 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6276 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6277 | /* Headphone and output */ |
| 6278 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6279 | /* mono output */ |
| 6280 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6281 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6282 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6283 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6284 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6285 | /* Line In pin widget for input */ |
| 6286 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6287 | /* Line-2 pin widget for output */ |
| 6288 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6289 | /* CD pin widget for input */ |
| 6290 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6291 | /* unmute amp left and right */ |
| 6292 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6293 | /* set connection select to line in (default select for this ADC) */ |
| 6294 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6295 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6296 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6297 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6298 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6299 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6300 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6301 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6302 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6303 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6304 | * Line In 2 = 0x03 |
| 6305 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6306 | /* mute analog inputs */ |
| 6307 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6308 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6309 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6310 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6311 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6312 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6313 | /* Unmute Front out path */ |
| 6314 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6315 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6316 | /* Unmute Headphone out path */ |
| 6317 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6318 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6319 | /* Unmute Mono out path */ |
| 6320 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6321 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6322 | { } |
| 6323 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6324 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6325 | |
| 6326 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6327 | /* Line out and output */ |
| 6328 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6329 | /* mono output */ |
| 6330 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6331 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6332 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6333 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6334 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6335 | /* Line In pin widget for input */ |
| 6336 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6337 | /* Headphone pin widget for output */ |
| 6338 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6339 | /* CD pin widget for input */ |
| 6340 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6341 | /* unmute amp left and right */ |
| 6342 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6343 | /* set connection select to line in (default select for this ADC) */ |
| 6344 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6345 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6346 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6347 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6348 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6349 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6350 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6351 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6352 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6353 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6354 | * Line In 2 = 0x03 |
| 6355 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6356 | /* mute analog inputs */ |
| 6357 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6358 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6359 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6360 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6361 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6362 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6363 | /* Unmute Front out path */ |
| 6364 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6365 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6366 | /* Unmute Headphone out path */ |
| 6367 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6368 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6369 | /* Unmute Mono out path */ |
| 6370 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6371 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6372 | { } |
| 6373 | }; |
| 6374 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6375 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6376 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6377 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6378 | */ |
| 6379 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6380 | /* Disable all GPIOs */ |
| 6381 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6382 | /* Internal speaker is connected to headphone pin */ |
| 6383 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6384 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6385 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6386 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6387 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6388 | /* Ensure all other unused pins are disabled and muted. */ |
| 6389 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6390 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6391 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6392 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6393 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6394 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6396 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6397 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6398 | /* Disable digital (SPDIF) pins */ |
| 6399 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6400 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6401 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6402 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6403 | * when acting as an output. |
| 6404 | */ |
| 6405 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6406 | |
| 6407 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6408 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6409 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6410 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6411 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6412 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6413 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6414 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6415 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6416 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6417 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6418 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6419 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6420 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6421 | * If the pin mode is changed by the user the pin mode control will |
| 6422 | * take care of enabling the pin's input/output buffers as needed. |
| 6423 | * Therefore there's no need to enable the input buffer at this |
| 6424 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6425 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6426 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6427 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6428 | * mixer ctrl) |
| 6429 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6430 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6431 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6432 | /* Mute capture amp left and right */ |
| 6433 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6434 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6435 | * in (on mic1 pin) |
| 6436 | */ |
| 6437 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6438 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6439 | /* Do the same for the second ADC: mute capture input amp and |
| 6440 | * set ADC connection to line in (on mic1 pin) |
| 6441 | */ |
| 6442 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6443 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6444 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6445 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6446 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6447 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6448 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6449 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6450 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6451 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6452 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6453 | {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] | 6454 | |
| 6455 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6456 | }; |
| 6457 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6458 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6459 | * similar laptops (adapted from Fujitsu init verbs). |
| 6460 | */ |
| 6461 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6462 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6463 | * the headphone jack. Turn this on and rely on the standard mute |
| 6464 | * methods whenever the user wants to turn these outputs off. |
| 6465 | */ |
| 6466 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6467 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6468 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6469 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6470 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6471 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6472 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6473 | /* Line In jack is connected to Line1 pin */ |
| 6474 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6475 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6476 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6477 | /* Ensure all other unused pins are disabled and muted. */ |
| 6478 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6479 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6480 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6481 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6482 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6483 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6484 | /* Disable digital (SPDIF) pins */ |
| 6485 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6486 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6487 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6488 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6489 | * bus when acting as outputs. |
| 6490 | */ |
| 6491 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6492 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6493 | |
| 6494 | /* Start with output sum widgets muted and their output gains at min */ |
| 6495 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6496 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6497 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6498 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6499 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6500 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6501 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6502 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6503 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6504 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6505 | /* Unmute Line-out pin widget amp left and right |
| 6506 | * (no equiv mixer ctrl) |
| 6507 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6508 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6509 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6510 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6511 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6512 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6513 | * will take care of enabling the pin's input/output buffers as needed. |
| 6514 | * Therefore there's no need to enable the input buffer at this |
| 6515 | * stage. |
| 6516 | */ |
| 6517 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6518 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6519 | |
| 6520 | /* Mute capture amp left and right */ |
| 6521 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6522 | /* Set ADC connection select to match default mixer setting - mic |
| 6523 | * (on mic1 pin) |
| 6524 | */ |
| 6525 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6526 | |
| 6527 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6528 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6529 | */ |
| 6530 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6531 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6532 | |
| 6533 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6534 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6535 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6536 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6537 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6538 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6539 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6540 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6541 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6542 | |
| 6543 | { } |
| 6544 | }; |
| 6545 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6546 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6547 | * (adapted from Acer init verbs). |
| 6548 | */ |
| 6549 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6550 | /* GPIO 0 enables the output jack. |
| 6551 | * Turn this on and rely on the standard mute |
| 6552 | * methods whenever the user wants to turn these outputs off. |
| 6553 | */ |
| 6554 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6555 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6556 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6557 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6558 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6559 | /* Ensure all other unused pins are disabled and muted. */ |
| 6560 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6561 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6562 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6563 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6564 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6565 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6566 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6567 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6568 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6569 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6570 | /* Disable digital (SPDIF) pins */ |
| 6571 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6572 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6573 | |
| 6574 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6575 | * bus when acting as outputs. |
| 6576 | */ |
| 6577 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6578 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6579 | |
| 6580 | /* Start with output sum widgets muted and their output gains at min */ |
| 6581 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6582 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6583 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6584 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6585 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6586 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6587 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6588 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6589 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6590 | |
| 6591 | /* Unmute Line-out pin widget amp left and right |
| 6592 | * (no equiv mixer ctrl) |
| 6593 | */ |
| 6594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6595 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6596 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6597 | * will take care of enabling the pin's input/output buffers as needed. |
| 6598 | * Therefore there's no need to enable the input buffer at this |
| 6599 | * stage. |
| 6600 | */ |
| 6601 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6602 | |
| 6603 | /* Mute capture amp left and right */ |
| 6604 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6605 | /* Set ADC connection select to match default mixer setting - mic |
| 6606 | * (on mic1 pin) |
| 6607 | */ |
| 6608 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6609 | |
| 6610 | /* Do similar with the second ADC: mute capture input amp and |
| 6611 | * set ADC connection to mic to match ALSA's default state. |
| 6612 | */ |
| 6613 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6614 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6615 | |
| 6616 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6617 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6618 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6619 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6620 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6621 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6622 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6623 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6624 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6625 | |
| 6626 | { } |
| 6627 | }; |
| 6628 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6629 | static struct hda_verb alc260_will_verbs[] = { |
| 6630 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6631 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6632 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6633 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6634 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6635 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6636 | {} |
| 6637 | }; |
| 6638 | |
| 6639 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6640 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6641 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6642 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6643 | |
| 6644 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6645 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6646 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6647 | |
| 6648 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6649 | {} |
| 6650 | }; |
| 6651 | |
| 6652 | /* toggle speaker-output according to the hp-jack state */ |
| 6653 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6654 | { |
| 6655 | unsigned int present; |
| 6656 | |
| 6657 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6658 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6659 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6660 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6661 | AC_VERB_SET_GPIO_DATA, 1); |
| 6662 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6663 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6664 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6665 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6666 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6667 | AC_VERB_SET_GPIO_DATA, 0); |
| 6668 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6669 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6670 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6671 | } |
| 6672 | } |
| 6673 | |
| 6674 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6675 | unsigned int res) |
| 6676 | { |
| 6677 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6678 | alc260_replacer_672v_automute(codec); |
| 6679 | } |
| 6680 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6681 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6682 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6683 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6684 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6685 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6686 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6687 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6688 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6689 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6690 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6691 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6692 | {} |
| 6693 | }; |
| 6694 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6695 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6696 | * configuration. |
| 6697 | */ |
| 6698 | #ifdef CONFIG_SND_DEBUG |
| 6699 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6700 | 0x02, |
| 6701 | }; |
| 6702 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6703 | 0x04, 0x05, |
| 6704 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6705 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6706 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6707 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6708 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6709 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6710 | { |
| 6711 | .num_items = 7, |
| 6712 | .items = { |
| 6713 | { "MIC1 pin", 0x0 }, |
| 6714 | { "MIC2 pin", 0x1 }, |
| 6715 | { "LINE1 pin", 0x2 }, |
| 6716 | { "LINE2 pin", 0x3 }, |
| 6717 | { "CD pin", 0x4 }, |
| 6718 | { "LINE-OUT pin", 0x5 }, |
| 6719 | { "HP-OUT pin", 0x6 }, |
| 6720 | }, |
| 6721 | }, |
| 6722 | { |
| 6723 | .num_items = 8, |
| 6724 | .items = { |
| 6725 | { "MIC1 pin", 0x0 }, |
| 6726 | { "MIC2 pin", 0x1 }, |
| 6727 | { "LINE1 pin", 0x2 }, |
| 6728 | { "LINE2 pin", 0x3 }, |
| 6729 | { "CD pin", 0x4 }, |
| 6730 | { "Mixer", 0x5 }, |
| 6731 | { "LINE-OUT pin", 0x6 }, |
| 6732 | { "HP-OUT pin", 0x7 }, |
| 6733 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6734 | }, |
| 6735 | }; |
| 6736 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6737 | /* Output driver widgets */ |
| 6738 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6739 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6740 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6741 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6742 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6743 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6744 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6745 | /* Modes for retasking pin widgets |
| 6746 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6747 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6748 | * mention this restriction. At this stage it's not clear whether |
| 6749 | * this behaviour is intentional or is a hardware bug in chip |
| 6750 | * revisions available at least up until early 2006. Therefore for |
| 6751 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6752 | * choices, but if it turns out that the lack of mic bias for these |
| 6753 | * NIDs is intentional we could change their modes from |
| 6754 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6755 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6756 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6757 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6758 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6759 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6760 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6761 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6762 | |
| 6763 | /* Loopback mixer controls */ |
| 6764 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6765 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6766 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6767 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6768 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6769 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6770 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6771 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6772 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6773 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6774 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6775 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6776 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6777 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6778 | |
| 6779 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6780 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6781 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6782 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6783 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6784 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6785 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6786 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6787 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6788 | */ |
| 6789 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6790 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6791 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6792 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6793 | * this output to turn on an external amplifier. |
| 6794 | */ |
| 6795 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6796 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6797 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6798 | { } /* end */ |
| 6799 | }; |
| 6800 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6801 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6802 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6803 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6804 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6805 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6806 | /* Enable retasking pins as output, initially without power amp */ |
| 6807 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6808 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6809 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6810 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6811 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6812 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6813 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6814 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6815 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6816 | * payload also sets the generation to 0, output to be in "consumer" |
| 6817 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6818 | * control. |
| 6819 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6820 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6821 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6822 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6823 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6824 | * OUT1 sum bus when acting as an output. |
| 6825 | */ |
| 6826 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6827 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6828 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6829 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6830 | |
| 6831 | /* Start with output sum widgets muted and their output gains at min */ |
| 6832 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6833 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6835 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6836 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6837 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6838 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6839 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6840 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6841 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6842 | /* Unmute retasking pin widget output buffers since the default |
| 6843 | * state appears to be output. As the pin mode is changed by the |
| 6844 | * user the pin mode control will take care of enabling the pin's |
| 6845 | * input/output buffers as needed. |
| 6846 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6847 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6848 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6849 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6850 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6851 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6852 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6853 | /* Also unmute the mono-out pin widget */ |
| 6854 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6855 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6856 | /* Mute capture amp left and right */ |
| 6857 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6858 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6859 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6860 | */ |
| 6861 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6862 | |
| 6863 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6864 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6865 | */ |
| 6866 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6867 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6868 | |
| 6869 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6870 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6871 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6872 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6873 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6874 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6875 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6876 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6877 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6878 | |
| 6879 | { } |
| 6880 | }; |
| 6881 | #endif |
| 6882 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6883 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6884 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6885 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6886 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6887 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6888 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6889 | /* |
| 6890 | * for BIOS auto-configuration |
| 6891 | */ |
| 6892 | |
| 6893 | 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] | 6894 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6895 | { |
| 6896 | hda_nid_t nid_vol; |
| 6897 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6898 | int err; |
| 6899 | |
| 6900 | if (nid >= 0x0f && nid < 0x11) { |
| 6901 | nid_vol = nid - 0x7; |
| 6902 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6903 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6904 | } else if (nid == 0x11) { |
| 6905 | nid_vol = nid - 0x7; |
| 6906 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6907 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6908 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6909 | nid_vol = 0x08; |
| 6910 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6911 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6912 | } else |
| 6913 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6914 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6915 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6916 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6917 | 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] | 6918 | if (err < 0) |
| 6919 | return err; |
| 6920 | *vol_bits |= (1 << nid_vol); |
| 6921 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6922 | 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] | 6923 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6924 | return err; |
| 6925 | return 1; |
| 6926 | } |
| 6927 | |
| 6928 | /* add playback controls from the parsed DAC table */ |
| 6929 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6930 | const struct auto_pin_cfg *cfg) |
| 6931 | { |
| 6932 | hda_nid_t nid; |
| 6933 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6934 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6935 | |
| 6936 | spec->multiout.num_dacs = 1; |
| 6937 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6938 | spec->multiout.dac_nids[0] = 0x02; |
| 6939 | |
| 6940 | nid = cfg->line_out_pins[0]; |
| 6941 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6942 | const char *pfx; |
| 6943 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6944 | pfx = "Master"; |
| 6945 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6946 | pfx = "Speaker"; |
| 6947 | else |
| 6948 | pfx = "Front"; |
| 6949 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6950 | if (err < 0) |
| 6951 | return err; |
| 6952 | } |
| 6953 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6954 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6955 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6956 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6957 | if (err < 0) |
| 6958 | return err; |
| 6959 | } |
| 6960 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6961 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6962 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6963 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6964 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6965 | if (err < 0) |
| 6966 | return err; |
| 6967 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6968 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6969 | } |
| 6970 | |
| 6971 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6972 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6973 | const struct auto_pin_cfg *cfg) |
| 6974 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6975 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6976 | } |
| 6977 | |
| 6978 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6979 | hda_nid_t nid, int pin_type, |
| 6980 | int sel_idx) |
| 6981 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6982 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6983 | /* need the manual connection? */ |
| 6984 | if (nid >= 0x12) { |
| 6985 | int idx = nid - 0x12; |
| 6986 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6987 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6988 | } |
| 6989 | } |
| 6990 | |
| 6991 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6992 | { |
| 6993 | struct alc_spec *spec = codec->spec; |
| 6994 | hda_nid_t nid; |
| 6995 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6996 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6997 | if (nid) { |
| 6998 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6999 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 7000 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7001 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7002 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7003 | if (nid) |
| 7004 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 7005 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7006 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7007 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7008 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7009 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7010 | |
| 7011 | #define ALC260_PIN_CD_NID 0x16 |
| 7012 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 7013 | { |
| 7014 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7015 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7016 | int i; |
| 7017 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7018 | for (i = 0; i < cfg->num_inputs; i++) { |
| 7019 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7020 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 7021 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 7022 | if (nid != ALC260_PIN_CD_NID && |
| 7023 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7024 | snd_hda_codec_write(codec, nid, 0, |
| 7025 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7026 | AMP_OUT_MUTE); |
| 7027 | } |
| 7028 | } |
| 7029 | } |
| 7030 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7031 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7032 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7033 | /* |
| 7034 | * generic initialization of ADC, input mixers and output mixers |
| 7035 | */ |
| 7036 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 7037 | /* |
| 7038 | * Unmute ADC0-1 and set the default input to mic-in |
| 7039 | */ |
| 7040 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7041 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7042 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7043 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7044 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7045 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7046 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7047 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7048 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7049 | */ |
| 7050 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7051 | /* mute analog inputs */ |
| 7052 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7053 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7054 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7055 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7056 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7057 | |
| 7058 | /* |
| 7059 | * Set up output mixers (0x08 - 0x0a) |
| 7060 | */ |
| 7061 | /* set vol=0 to output mixers */ |
| 7062 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7063 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7064 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7065 | /* set up input amps for analog loopback */ |
| 7066 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7067 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7068 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7069 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7070 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7071 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7072 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7073 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7074 | { } |
| 7075 | }; |
| 7076 | |
| 7077 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7078 | { |
| 7079 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7080 | int err; |
| 7081 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7082 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7083 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7084 | alc260_ignore); |
| 7085 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7086 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7087 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7088 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7089 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7090 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7091 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7092 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7093 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7094 | return err; |
| 7095 | |
| 7096 | spec->multiout.max_channels = 2; |
| 7097 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7098 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7099 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7100 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7101 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7102 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7103 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7104 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7105 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7106 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7107 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7108 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7109 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7110 | return 1; |
| 7111 | } |
| 7112 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7113 | /* additional initialization for auto-configuration model */ |
| 7114 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7115 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7116 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7117 | alc260_auto_init_multi_out(codec); |
| 7118 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7119 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7120 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7121 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7122 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7123 | } |
| 7124 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7125 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7126 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7127 | { 0x07, HDA_INPUT, 0 }, |
| 7128 | { 0x07, HDA_INPUT, 1 }, |
| 7129 | { 0x07, HDA_INPUT, 2 }, |
| 7130 | { 0x07, HDA_INPUT, 3 }, |
| 7131 | { 0x07, HDA_INPUT, 4 }, |
| 7132 | { } /* end */ |
| 7133 | }; |
| 7134 | #endif |
| 7135 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7136 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7137 | * Pin config fixes |
| 7138 | */ |
| 7139 | enum { |
| 7140 | PINFIX_HP_DC5750, |
| 7141 | }; |
| 7142 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7143 | static const struct alc_fixup alc260_fixups[] = { |
| 7144 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7145 | .type = ALC_FIXUP_PINS, |
| 7146 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7147 | { 0x11, 0x90130110 }, /* speaker */ |
| 7148 | { } |
| 7149 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7150 | }, |
| 7151 | }; |
| 7152 | |
| 7153 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7154 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7155 | {} |
| 7156 | }; |
| 7157 | |
| 7158 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7159 | * ALC260 configurations |
| 7160 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7161 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 7162 | [ALC260_BASIC] = "basic", |
| 7163 | [ALC260_HP] = "hp", |
| 7164 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7165 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7166 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7167 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7168 | [ALC260_WILL] = "will", |
| 7169 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7170 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7171 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7172 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7173 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7174 | [ALC260_AUTO] = "auto", |
| 7175 | }; |
| 7176 | |
| 7177 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7178 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7179 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7180 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7181 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7182 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7183 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7184 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7185 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7186 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7187 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7188 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7189 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7190 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7191 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7192 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7193 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7194 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7195 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7196 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7197 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7198 | {} |
| 7199 | }; |
| 7200 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7201 | static struct alc_config_preset alc260_presets[] = { |
| 7202 | [ALC260_BASIC] = { |
| 7203 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7204 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7205 | .init_verbs = { alc260_init_verbs }, |
| 7206 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7207 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7208 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7209 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7210 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7211 | .channel_mode = alc260_modes, |
| 7212 | .input_mux = &alc260_capture_source, |
| 7213 | }, |
| 7214 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7215 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7216 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7217 | .init_verbs = { alc260_init_verbs, |
| 7218 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7219 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7220 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7221 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7222 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7223 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7224 | .channel_mode = alc260_modes, |
| 7225 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7226 | .unsol_event = alc260_hp_unsol_event, |
| 7227 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7228 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7229 | [ALC260_HP_DC7600] = { |
| 7230 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7231 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7232 | .init_verbs = { alc260_init_verbs, |
| 7233 | alc260_hp_dc7600_verbs }, |
| 7234 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7235 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7236 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7237 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7238 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7239 | .channel_mode = alc260_modes, |
| 7240 | .input_mux = &alc260_capture_source, |
| 7241 | .unsol_event = alc260_hp_3012_unsol_event, |
| 7242 | .init_hook = alc260_hp_3012_automute, |
| 7243 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7244 | [ALC260_HP_3013] = { |
| 7245 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7246 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7247 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7248 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7249 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7250 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7251 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7252 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7253 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7254 | .channel_mode = alc260_modes, |
| 7255 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7256 | .unsol_event = alc260_hp_3013_unsol_event, |
| 7257 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7258 | }, |
| 7259 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7260 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7261 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7262 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7263 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7264 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7265 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7266 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7267 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7268 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7269 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7270 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7271 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7272 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7273 | .init_verbs = { alc260_acer_init_verbs }, |
| 7274 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7275 | .dac_nids = alc260_dac_nids, |
| 7276 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7277 | .adc_nids = alc260_dual_adc_nids, |
| 7278 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7279 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7280 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7281 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7282 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7283 | [ALC260_FAVORIT100] = { |
| 7284 | .mixers = { alc260_favorit100_mixer }, |
| 7285 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7286 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7287 | .dac_nids = alc260_dac_nids, |
| 7288 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7289 | .adc_nids = alc260_dual_adc_nids, |
| 7290 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7291 | .channel_mode = alc260_modes, |
| 7292 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7293 | .input_mux = alc260_favorit100_capture_sources, |
| 7294 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7295 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7296 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7297 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7298 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7299 | .dac_nids = alc260_dac_nids, |
| 7300 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7301 | .adc_nids = alc260_adc_nids, |
| 7302 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7303 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7304 | .channel_mode = alc260_modes, |
| 7305 | .input_mux = &alc260_capture_source, |
| 7306 | }, |
| 7307 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7308 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7309 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7310 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7311 | .dac_nids = alc260_dac_nids, |
| 7312 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7313 | .adc_nids = alc260_adc_nids, |
| 7314 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7315 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7316 | .channel_mode = alc260_modes, |
| 7317 | .input_mux = &alc260_capture_source, |
| 7318 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7319 | .init_hook = alc260_replacer_672v_automute, |
| 7320 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7321 | #ifdef CONFIG_SND_DEBUG |
| 7322 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7323 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7324 | .init_verbs = { alc260_test_init_verbs }, |
| 7325 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7326 | .dac_nids = alc260_test_dac_nids, |
| 7327 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7328 | .adc_nids = alc260_test_adc_nids, |
| 7329 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7330 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7331 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7332 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7333 | }, |
| 7334 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7335 | }; |
| 7336 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7337 | static int patch_alc260(struct hda_codec *codec) |
| 7338 | { |
| 7339 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7340 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7341 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7342 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7343 | if (spec == NULL) |
| 7344 | return -ENOMEM; |
| 7345 | |
| 7346 | codec->spec = spec; |
| 7347 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7348 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7349 | alc260_models, |
| 7350 | alc260_cfg_tbl); |
| 7351 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7352 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7353 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7354 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7355 | } |
| 7356 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7357 | if (board_config == ALC260_AUTO) { |
| 7358 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7359 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7360 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7361 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7362 | if (board_config == ALC260_AUTO) { |
| 7363 | /* automatic parse from the BIOS config */ |
| 7364 | err = alc260_parse_auto_config(codec); |
| 7365 | if (err < 0) { |
| 7366 | alc_free(codec); |
| 7367 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7368 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7369 | printk(KERN_INFO |
| 7370 | "hda_codec: Cannot set up configuration " |
| 7371 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7372 | board_config = ALC260_BASIC; |
| 7373 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7374 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7375 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7376 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7377 | if (err < 0) { |
| 7378 | alc_free(codec); |
| 7379 | return err; |
| 7380 | } |
| 7381 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7382 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7383 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7384 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7385 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7386 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7387 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7388 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7389 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7390 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7391 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7392 | if (!spec->adc_nids && spec->input_mux) { |
| 7393 | /* check whether NID 0x04 is valid */ |
| 7394 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7395 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7396 | /* get type */ |
| 7397 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7398 | spec->adc_nids = alc260_adc_nids_alt; |
| 7399 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7400 | } else { |
| 7401 | spec->adc_nids = alc260_adc_nids; |
| 7402 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7403 | } |
| 7404 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7405 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7406 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7407 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7408 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7409 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7410 | spec->vmaster_nid = 0x08; |
| 7411 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7412 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7413 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7414 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7415 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7416 | if (!spec->loopback.amplist) |
| 7417 | spec->loopback.amplist = alc260_loopbacks; |
| 7418 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7419 | |
| 7420 | return 0; |
| 7421 | } |
| 7422 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7423 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7424 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7425 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7426 | * |
| 7427 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7428 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7429 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7430 | * 6-channel independent captures. |
| 7431 | * |
| 7432 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7433 | * driver yet). |
| 7434 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7435 | #define ALC882_DIGOUT_NID 0x06 |
| 7436 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7437 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7438 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7439 | #define ALC1200_DIGOUT_NID 0x10 |
| 7440 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7441 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7442 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7443 | { 8, NULL } |
| 7444 | }; |
| 7445 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7446 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7447 | static hda_nid_t alc882_dac_nids[4] = { |
| 7448 | /* front, rear, clfe, rear_surr */ |
| 7449 | 0x02, 0x03, 0x04, 0x05 |
| 7450 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7451 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7452 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7453 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7454 | #define alc882_adc_nids alc880_adc_nids |
| 7455 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7456 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7457 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7458 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7459 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7460 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7461 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7462 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7463 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7464 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7465 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7466 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7467 | /* input MUX */ |
| 7468 | /* FIXME: should be a matrix-type input source selection */ |
| 7469 | |
| 7470 | static struct hda_input_mux alc882_capture_source = { |
| 7471 | .num_items = 4, |
| 7472 | .items = { |
| 7473 | { "Mic", 0x0 }, |
| 7474 | { "Front Mic", 0x1 }, |
| 7475 | { "Line", 0x2 }, |
| 7476 | { "CD", 0x4 }, |
| 7477 | }, |
| 7478 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7479 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7480 | #define alc883_capture_source alc882_capture_source |
| 7481 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7482 | static struct hda_input_mux alc889_capture_source = { |
| 7483 | .num_items = 3, |
| 7484 | .items = { |
| 7485 | { "Front Mic", 0x0 }, |
| 7486 | { "Mic", 0x3 }, |
| 7487 | { "Line", 0x2 }, |
| 7488 | }, |
| 7489 | }; |
| 7490 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7491 | static struct hda_input_mux mb5_capture_source = { |
| 7492 | .num_items = 3, |
| 7493 | .items = { |
| 7494 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7495 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7496 | { "CD", 0x4 }, |
| 7497 | }, |
| 7498 | }; |
| 7499 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7500 | static struct hda_input_mux macmini3_capture_source = { |
| 7501 | .num_items = 2, |
| 7502 | .items = { |
| 7503 | { "Line", 0x2 }, |
| 7504 | { "CD", 0x4 }, |
| 7505 | }, |
| 7506 | }; |
| 7507 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7508 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7509 | .num_items = 4, |
| 7510 | .items = { |
| 7511 | { "Mic", 0x1 }, |
| 7512 | { "Front Mic", 0x0 }, |
| 7513 | { "Line", 0x2 }, |
| 7514 | { "CD", 0x4 }, |
| 7515 | }, |
| 7516 | }; |
| 7517 | |
| 7518 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7519 | .num_items = 2, |
| 7520 | .items = { |
| 7521 | { "Mic", 0x1 }, |
| 7522 | { "Line", 0x2 }, |
| 7523 | }, |
| 7524 | }; |
| 7525 | |
| 7526 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7527 | .num_items = 4, |
| 7528 | .items = { |
| 7529 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7530 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7531 | { "Line", 0x2 }, |
| 7532 | { "CD", 0x4 }, |
| 7533 | }, |
| 7534 | }; |
| 7535 | |
| 7536 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7537 | .num_items = 2, |
| 7538 | .items = { |
| 7539 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7540 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7541 | }, |
| 7542 | }; |
| 7543 | |
| 7544 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7545 | .num_items = 3, |
| 7546 | .items = { |
| 7547 | { "Mic", 0x0 }, |
| 7548 | { "Front Mic", 0x1 }, |
| 7549 | { "Line", 0x4 }, |
| 7550 | }, |
| 7551 | }; |
| 7552 | |
| 7553 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7554 | .num_items = 2, |
| 7555 | .items = { |
| 7556 | { "Mic", 0x0 }, |
| 7557 | { "Line", 0x2 }, |
| 7558 | }, |
| 7559 | }; |
| 7560 | |
| 7561 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7562 | .num_items = 2, |
| 7563 | .items = { |
| 7564 | { "Mic", 0x0 }, |
| 7565 | /* Front Mic (0x01) unused */ |
| 7566 | { "Line", 0x2 }, |
| 7567 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7568 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7569 | }, |
| 7570 | }; |
| 7571 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7572 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7573 | .num_items = 2, |
| 7574 | .items = { |
| 7575 | { "Mic", 0x01 }, |
| 7576 | { "Line", 0x2 }, /* Not sure! */ |
| 7577 | }, |
| 7578 | }; |
| 7579 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7580 | /* |
| 7581 | * 2ch mode |
| 7582 | */ |
| 7583 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7584 | { 2, NULL } |
| 7585 | }; |
| 7586 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7587 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7588 | * 2ch mode |
| 7589 | */ |
| 7590 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7591 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7592 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7593 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7594 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7595 | { } /* end */ |
| 7596 | }; |
| 7597 | |
| 7598 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7599 | * 4ch mode |
| 7600 | */ |
| 7601 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7602 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7603 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7604 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7605 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7606 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7607 | { } /* end */ |
| 7608 | }; |
| 7609 | |
| 7610 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7611 | * 6ch mode |
| 7612 | */ |
| 7613 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7614 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7615 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7616 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7617 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7618 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7619 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7620 | { } /* end */ |
| 7621 | }; |
| 7622 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7623 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7624 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7625 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7626 | { 6, alc882_3ST_ch6_init }, |
| 7627 | }; |
| 7628 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7629 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7630 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7631 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7632 | * 2ch mode |
| 7633 | */ |
| 7634 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7635 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7636 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7637 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7638 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7639 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7640 | { } /* end */ |
| 7641 | }; |
| 7642 | |
| 7643 | /* |
| 7644 | * 4ch mode |
| 7645 | */ |
| 7646 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7647 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7648 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7649 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7650 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7651 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7652 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7653 | { } /* end */ |
| 7654 | }; |
| 7655 | |
| 7656 | /* |
| 7657 | * 6ch mode |
| 7658 | */ |
| 7659 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7660 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7661 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7662 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7663 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7664 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7665 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7666 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7667 | { } /* end */ |
| 7668 | }; |
| 7669 | |
| 7670 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7671 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7672 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7673 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7674 | }; |
| 7675 | |
| 7676 | |
| 7677 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7678 | * 6ch mode |
| 7679 | */ |
| 7680 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7681 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7682 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7683 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7684 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7685 | { } /* end */ |
| 7686 | }; |
| 7687 | |
| 7688 | /* |
| 7689 | * 8ch mode |
| 7690 | */ |
| 7691 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7692 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7693 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7694 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7695 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7696 | { } /* end */ |
| 7697 | }; |
| 7698 | |
| 7699 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7700 | { 6, alc882_sixstack_ch6_init }, |
| 7701 | { 8, alc882_sixstack_ch8_init }, |
| 7702 | }; |
| 7703 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7704 | |
| 7705 | /* Macbook Air 2,1 */ |
| 7706 | |
| 7707 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7708 | { 2, NULL }, |
| 7709 | }; |
| 7710 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7711 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7712 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7713 | */ |
| 7714 | |
| 7715 | /* |
| 7716 | * 2ch mode |
| 7717 | */ |
| 7718 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7719 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7720 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7721 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7722 | { } /* end */ |
| 7723 | }; |
| 7724 | |
| 7725 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7726 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7727 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7728 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7729 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7730 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7731 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7732 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7733 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7734 | { } /* end */ |
| 7735 | }; |
| 7736 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7737 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7738 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7739 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7740 | }; |
| 7741 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7742 | /* |
| 7743 | * 2ch |
| 7744 | * Speakers/Woofer/HP = Front |
| 7745 | * LineIn = Input |
| 7746 | */ |
| 7747 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7748 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7749 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7750 | { } /* end */ |
| 7751 | }; |
| 7752 | |
| 7753 | /* |
| 7754 | * 6ch mode |
| 7755 | * Speakers/HP = Front |
| 7756 | * Woofer = LFE |
| 7757 | * LineIn = Surround |
| 7758 | */ |
| 7759 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7760 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7761 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7762 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7763 | { } /* end */ |
| 7764 | }; |
| 7765 | |
| 7766 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7767 | { 2, alc885_mb5_ch2_init }, |
| 7768 | { 6, alc885_mb5_ch6_init }, |
| 7769 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7770 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7771 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7772 | |
| 7773 | /* |
| 7774 | * 2ch mode |
| 7775 | */ |
| 7776 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7777 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7778 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7779 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7780 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7781 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7782 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7783 | { } /* end */ |
| 7784 | }; |
| 7785 | |
| 7786 | /* |
| 7787 | * 4ch mode |
| 7788 | */ |
| 7789 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7790 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7791 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7792 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7793 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7794 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7795 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7796 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7797 | { } /* end */ |
| 7798 | }; |
| 7799 | |
| 7800 | /* |
| 7801 | * 6ch mode |
| 7802 | */ |
| 7803 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7804 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7805 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7806 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7807 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7808 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7809 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7810 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7811 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7812 | { } /* end */ |
| 7813 | }; |
| 7814 | |
| 7815 | /* |
| 7816 | * 8ch mode |
| 7817 | */ |
| 7818 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7819 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7820 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7821 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7822 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7823 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7824 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7825 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7826 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7827 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7828 | { } /* end */ |
| 7829 | }; |
| 7830 | |
| 7831 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7832 | { 2, alc883_4ST_ch2_init }, |
| 7833 | { 4, alc883_4ST_ch4_init }, |
| 7834 | { 6, alc883_4ST_ch6_init }, |
| 7835 | { 8, alc883_4ST_ch8_init }, |
| 7836 | }; |
| 7837 | |
| 7838 | |
| 7839 | /* |
| 7840 | * 2ch mode |
| 7841 | */ |
| 7842 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7843 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7844 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7845 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7846 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7847 | { } /* end */ |
| 7848 | }; |
| 7849 | |
| 7850 | /* |
| 7851 | * 4ch mode |
| 7852 | */ |
| 7853 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7854 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7855 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7856 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7857 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7858 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7859 | { } /* end */ |
| 7860 | }; |
| 7861 | |
| 7862 | /* |
| 7863 | * 6ch mode |
| 7864 | */ |
| 7865 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7866 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7867 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7868 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7869 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7870 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7871 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7872 | { } /* end */ |
| 7873 | }; |
| 7874 | |
| 7875 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7876 | { 2, alc883_3ST_ch2_intel_init }, |
| 7877 | { 4, alc883_3ST_ch4_intel_init }, |
| 7878 | { 6, alc883_3ST_ch6_intel_init }, |
| 7879 | }; |
| 7880 | |
| 7881 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7882 | * 2ch mode |
| 7883 | */ |
| 7884 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7885 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7886 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7887 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7888 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7889 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7890 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7891 | { } /* end */ |
| 7892 | }; |
| 7893 | |
| 7894 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7895 | * 6ch mode |
| 7896 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7897 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7898 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7899 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7900 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7901 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7902 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7903 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7904 | { } /* end */ |
| 7905 | }; |
| 7906 | |
| 7907 | /* |
| 7908 | * 8ch mode |
| 7909 | */ |
| 7910 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7911 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7912 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7913 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7914 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7915 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7916 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7917 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7918 | { } /* end */ |
| 7919 | }; |
| 7920 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7921 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7922 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7923 | { 6, alc889_ch6_intel_init }, |
| 7924 | { 8, alc889_ch8_intel_init }, |
| 7925 | }; |
| 7926 | |
| 7927 | /* |
| 7928 | * 6ch mode |
| 7929 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7930 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7931 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7932 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7933 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7934 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7935 | { } /* end */ |
| 7936 | }; |
| 7937 | |
| 7938 | /* |
| 7939 | * 8ch mode |
| 7940 | */ |
| 7941 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7942 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7943 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7944 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7945 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7946 | { } /* end */ |
| 7947 | }; |
| 7948 | |
| 7949 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7950 | { 6, alc883_sixstack_ch6_init }, |
| 7951 | { 8, alc883_sixstack_ch8_init }, |
| 7952 | }; |
| 7953 | |
| 7954 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7955 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7956 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7957 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7958 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7959 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7960 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7961 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7962 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7963 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7964 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7965 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7966 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7967 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7968 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7969 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7970 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7971 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7972 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7973 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7974 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7975 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7976 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7977 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7978 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7979 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7980 | { } /* end */ |
| 7981 | }; |
| 7982 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7983 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7984 | |
| 7985 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7986 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7987 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7988 | { } |
| 7989 | }; |
| 7990 | |
| 7991 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7992 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7993 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7994 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7995 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7996 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7997 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7999 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8001 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8002 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 8003 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8004 | { } /* end */ |
| 8005 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8006 | |
| 8007 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8008 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8009 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8010 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8011 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8012 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8013 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8014 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8015 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8016 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8017 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8018 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8019 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8020 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 8021 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8022 | { } /* end */ |
| 8023 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8024 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8025 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 8026 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8027 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8028 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8029 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8030 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8031 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8032 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8033 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8034 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8035 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8036 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8037 | { } /* end */ |
| 8038 | }; |
| 8039 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8040 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8041 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8042 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8043 | { } /* end */ |
| 8044 | }; |
| 8045 | |
| 8046 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8047 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 8048 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8049 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8050 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8051 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8052 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8053 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8054 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8055 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8056 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8057 | { } /* end */ |
| 8058 | }; |
| 8059 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8060 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 8061 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8062 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8063 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8064 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8065 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8066 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8067 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8068 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8069 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8070 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8071 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8072 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8073 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8074 | { } /* end */ |
| 8075 | }; |
| 8076 | |
| 8077 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8078 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8079 | */ |
| 8080 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8081 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8082 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8083 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8084 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8085 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8086 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8087 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8088 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8089 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8090 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8091 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8092 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8093 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8094 | { } /* end */ |
| 8095 | }; |
| 8096 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8097 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8098 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8099 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8100 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8101 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8102 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8103 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8104 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8105 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8106 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8107 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8108 | { } /* end */ |
| 8109 | }; |
| 8110 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8111 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8112 | { |
| 8113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8114 | .name = "Channel Mode", |
| 8115 | .info = alc_ch_mode_info, |
| 8116 | .get = alc_ch_mode_get, |
| 8117 | .put = alc_ch_mode_put, |
| 8118 | }, |
| 8119 | { } /* end */ |
| 8120 | }; |
| 8121 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8122 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8123 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8124 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8125 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8126 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8127 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8128 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8129 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8130 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8131 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8132 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8133 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8134 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8135 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8136 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8137 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8138 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8139 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8140 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8141 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8142 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8143 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8144 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8145 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8146 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8147 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8148 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8149 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8150 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8151 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8152 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8153 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8154 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8155 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8156 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8157 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8158 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8159 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8160 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8161 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8162 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8163 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8164 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8165 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8166 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8167 | |
| 8168 | /* FIXME: use matrix-type input source selection */ |
| 8169 | /* 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] | 8170 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8171 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8172 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8173 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8174 | /* ADC2: mute amp left and right */ |
| 8175 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8176 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8177 | /* ADC3: mute amp left and right */ |
| 8178 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8179 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8180 | |
| 8181 | { } |
| 8182 | }; |
| 8183 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8184 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8185 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8186 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8187 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8188 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8189 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8190 | /* ADC1: mute amp left and right */ |
| 8191 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8192 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8193 | { } |
| 8194 | }; |
| 8195 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8196 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8197 | /* change to EAPD mode */ |
| 8198 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8199 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8200 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8201 | }; |
| 8202 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8203 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8204 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8205 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8206 | { } |
| 8207 | }; |
| 8208 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8209 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8210 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8212 | {} |
| 8213 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8214 | |
| 8215 | static struct hda_verb alc885_init_verbs[] = { |
| 8216 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8217 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8218 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8219 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8220 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8221 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8222 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8223 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8224 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8225 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8226 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8227 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8228 | |
| 8229 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8230 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8231 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8232 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8233 | /* Front Pin: output 0 (0x0c) */ |
| 8234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8235 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8236 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8237 | /* Rear Pin: output 1 (0x0d) */ |
| 8238 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8239 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8240 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8241 | /* CLFE Pin: output 2 (0x0e) */ |
| 8242 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8243 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8244 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8245 | /* Side Pin: output 3 (0x0f) */ |
| 8246 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8247 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8248 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8249 | /* Mic (rear) pin: input vref at 80% */ |
| 8250 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8251 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8252 | /* Front Mic pin: input vref at 80% */ |
| 8253 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8254 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8255 | /* Line In pin: input */ |
| 8256 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8257 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8258 | |
| 8259 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8260 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8261 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8262 | /* Input mixer2 */ |
| 8263 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8264 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8266 | /* ADC2: mute amp left and right */ |
| 8267 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8268 | /* ADC3: mute amp left and right */ |
| 8269 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8270 | |
| 8271 | { } |
| 8272 | }; |
| 8273 | |
| 8274 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8275 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8276 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8277 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8278 | { } |
| 8279 | }; |
| 8280 | |
| 8281 | |
| 8282 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8283 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8284 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8285 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8286 | { } |
| 8287 | }; |
| 8288 | |
| 8289 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8290 | #define alc883_init_verbs alc882_base_init_verbs |
| 8291 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8292 | /* Mac Pro test */ |
| 8293 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8294 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8295 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8296 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8297 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8298 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8299 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8300 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8301 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8302 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8303 | { } /* end */ |
| 8304 | }; |
| 8305 | |
| 8306 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8307 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8311 | /* Front Pin: output 0 (0x0c) */ |
| 8312 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8313 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8314 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8315 | /* Front Mic pin: input vref at 80% */ |
| 8316 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8317 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8318 | /* Speaker: output */ |
| 8319 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8320 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8321 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8322 | /* Headphone output (output 0 - 0x0c) */ |
| 8323 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8324 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8325 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8326 | |
| 8327 | /* FIXME: use matrix-type input source selection */ |
| 8328 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8329 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8330 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8331 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8332 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8333 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8334 | /* Input mixer2 */ |
| 8335 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8336 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8337 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8338 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8339 | /* Input mixer3 */ |
| 8340 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8341 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8342 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8343 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8344 | /* ADC1: mute amp left and right */ |
| 8345 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8346 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8347 | /* ADC2: mute amp left and right */ |
| 8348 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8349 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8350 | /* ADC3: mute amp left and right */ |
| 8351 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8352 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8353 | |
| 8354 | { } |
| 8355 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8356 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8357 | /* Macbook 5,1 */ |
| 8358 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8359 | /* DACs */ |
| 8360 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8361 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8362 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8363 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8364 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8365 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8368 | /* Surround mixer */ |
| 8369 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8370 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8371 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8372 | /* LFE mixer */ |
| 8373 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8374 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8375 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8376 | /* HP mixer */ |
| 8377 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8378 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8379 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8380 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8381 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8382 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8383 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8384 | /* LFE Pin (0x0e) */ |
| 8385 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8386 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8387 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8388 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8389 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8390 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8391 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8392 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8393 | /* Front Mic pin: input vref at 80% */ |
| 8394 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8395 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8396 | /* Line In pin */ |
| 8397 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8398 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8399 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8400 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8401 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8402 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8403 | { } |
| 8404 | }; |
| 8405 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8406 | /* Macmini 3,1 */ |
| 8407 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8408 | /* DACs */ |
| 8409 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8410 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8411 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8412 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8413 | /* Front mixer */ |
| 8414 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8415 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8416 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8417 | /* Surround mixer */ |
| 8418 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8419 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8420 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8421 | /* LFE mixer */ |
| 8422 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8423 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8424 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8425 | /* HP mixer */ |
| 8426 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8427 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8428 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8429 | /* Front Pin (0x0c) */ |
| 8430 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8431 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8432 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8433 | /* LFE Pin (0x0e) */ |
| 8434 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8435 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8436 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8437 | /* HP Pin (0x0f) */ |
| 8438 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8439 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8440 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8441 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8442 | /* Line In pin */ |
| 8443 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8444 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8445 | |
| 8446 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8447 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8448 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8449 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8450 | { } |
| 8451 | }; |
| 8452 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8453 | |
| 8454 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8455 | /*Internal and HP Speaker Mixer*/ |
| 8456 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8459 | /*Internal Speaker Pin (0x0c)*/ |
| 8460 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8461 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8462 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8463 | /* HP Pin: output 0 (0x0e) */ |
| 8464 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8465 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8466 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8467 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8468 | /* Line in (is hp when jack connected)*/ |
| 8469 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8470 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8471 | |
| 8472 | { } |
| 8473 | }; |
| 8474 | |
| 8475 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8476 | /* Macbook Pro rev3 */ |
| 8477 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8478 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8479 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8480 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8481 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8482 | /* Rear mixer */ |
| 8483 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8484 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8485 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8486 | /* HP mixer */ |
| 8487 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8488 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8489 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8490 | /* Front Pin: output 0 (0x0c) */ |
| 8491 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8492 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8493 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8494 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8495 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8496 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8497 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8498 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8499 | /* Mic (rear) pin: input vref at 80% */ |
| 8500 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8501 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8502 | /* Front Mic pin: input vref at 80% */ |
| 8503 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8504 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8505 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8506 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8507 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8508 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8509 | |
| 8510 | /* FIXME: use matrix-type input source selection */ |
| 8511 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8512 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8513 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8514 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8515 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8516 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8517 | /* Input mixer2 */ |
| 8518 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8519 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8520 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8521 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8522 | /* Input mixer3 */ |
| 8523 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8524 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8527 | /* ADC1: mute amp left and right */ |
| 8528 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8529 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8530 | /* ADC2: mute amp left and right */ |
| 8531 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8532 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8533 | /* ADC3: mute amp left and right */ |
| 8534 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8535 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8536 | |
| 8537 | { } |
| 8538 | }; |
| 8539 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8540 | /* iMac 9,1 */ |
| 8541 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8542 | /* Internal Speaker Pin (0x0c) */ |
| 8543 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8544 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8545 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8546 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8547 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8548 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8549 | /* HP Pin: Rear */ |
| 8550 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8551 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8552 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8553 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8554 | /* Line in Rear */ |
| 8555 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8556 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8557 | /* Front Mic pin: input vref at 80% */ |
| 8558 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8559 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8560 | /* Rear mixer */ |
| 8561 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8562 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8563 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8564 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8565 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8566 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8567 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8568 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8569 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8570 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8571 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8572 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8573 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8574 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8575 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8576 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8577 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8578 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8579 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8580 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8581 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8582 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8583 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8584 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8585 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8586 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8587 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8588 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8589 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8590 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8591 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8592 | { } |
| 8593 | }; |
| 8594 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8595 | /* iMac 24 mixer. */ |
| 8596 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8597 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8598 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8599 | { } /* end */ |
| 8600 | }; |
| 8601 | |
| 8602 | /* iMac 24 init verbs. */ |
| 8603 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8604 | /* Internal speakers: output 0 (0x0c) */ |
| 8605 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8606 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8607 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8608 | /* Internal speakers: output 0 (0x0c) */ |
| 8609 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8610 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8611 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8612 | /* Headphone: output 0 (0x0c) */ |
| 8613 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8614 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8615 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8616 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8617 | /* Front Mic: input vref at 80% */ |
| 8618 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8619 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8620 | { } |
| 8621 | }; |
| 8622 | |
| 8623 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8624 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8625 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8626 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8627 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8628 | spec->autocfg.hp_pins[0] = 0x14; |
| 8629 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8630 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8631 | } |
| 8632 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8633 | #define alc885_mb5_setup alc885_imac24_setup |
| 8634 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8635 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8636 | /* Macbook Air 2,1 */ |
| 8637 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8638 | { |
| 8639 | struct alc_spec *spec = codec->spec; |
| 8640 | |
| 8641 | spec->autocfg.hp_pins[0] = 0x14; |
| 8642 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8643 | } |
| 8644 | |
| 8645 | |
| 8646 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8647 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8648 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8649 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8650 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8651 | spec->autocfg.hp_pins[0] = 0x15; |
| 8652 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8653 | } |
| 8654 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8655 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8656 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8657 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8658 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8659 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8660 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8661 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8662 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8663 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8664 | static struct hda_verb alc882_targa_verbs[] = { |
| 8665 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8666 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8667 | |
| 8668 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8669 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8670 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8671 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8672 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8673 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8674 | |
| 8675 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8676 | { } /* end */ |
| 8677 | }; |
| 8678 | |
| 8679 | /* toggle speaker-output according to the hp-jack state */ |
| 8680 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8681 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8682 | struct alc_spec *spec = codec->spec; |
| 8683 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8684 | 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] | 8685 | spec->jack_present ? 1 : 3); |
| 8686 | } |
| 8687 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8688 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8689 | { |
| 8690 | struct alc_spec *spec = codec->spec; |
| 8691 | |
| 8692 | spec->autocfg.hp_pins[0] = 0x14; |
| 8693 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8694 | } |
| 8695 | |
| 8696 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8697 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8698 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8699 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8700 | } |
| 8701 | |
| 8702 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8703 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8704 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8705 | |
| 8706 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8708 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8709 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8710 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8711 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8712 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8713 | |
| 8714 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8715 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8716 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8717 | { } /* end */ |
| 8718 | }; |
| 8719 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8720 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8721 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8722 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8723 | |
| 8724 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8725 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8726 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8727 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8728 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8729 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8730 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8731 | |
| 8732 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8733 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8734 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8735 | { } /* end */ |
| 8736 | }; |
| 8737 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8738 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8739 | { |
| 8740 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8741 | |
| 8742 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8743 | AC_VERB_GET_GPIO_DATA, 0); |
| 8744 | |
| 8745 | if (!muted) |
| 8746 | gpiostate |= (1 << pin); |
| 8747 | else |
| 8748 | gpiostate &= ~(1 << pin); |
| 8749 | |
| 8750 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8751 | AC_VERB_GET_GPIO_MASK, 0); |
| 8752 | gpiomask |= (1 << pin); |
| 8753 | |
| 8754 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8755 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8756 | gpiodir |= (1 << pin); |
| 8757 | |
| 8758 | |
| 8759 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8760 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8761 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8762 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8763 | |
| 8764 | msleep(1); |
| 8765 | |
| 8766 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8767 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8768 | } |
| 8769 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8770 | /* set up GPIO at initialization */ |
| 8771 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8772 | { |
| 8773 | alc882_gpio_mute(codec, 0, 0); |
| 8774 | alc882_gpio_mute(codec, 1, 0); |
| 8775 | } |
| 8776 | |
| 8777 | /* set up GPIO and update auto-muting at initialization */ |
| 8778 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8779 | { |
| 8780 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8781 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8782 | } |
| 8783 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8784 | /* |
| 8785 | * generic initialization of ADC, input mixers and output mixers |
| 8786 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8787 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8788 | /* |
| 8789 | * Unmute ADC0-2 and set the default input to mic-in |
| 8790 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8791 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8792 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8793 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8794 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8795 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8796 | /* |
| 8797 | * Set up output mixers (0x0c - 0x0f) |
| 8798 | */ |
| 8799 | /* set vol=0 to output mixers */ |
| 8800 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8801 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8802 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8803 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8804 | /* set up input amps for analog loopback */ |
| 8805 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8806 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8807 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8808 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8809 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8810 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8811 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8812 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8813 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8814 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8815 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8816 | |
| 8817 | /* FIXME: use matrix-type input source selection */ |
| 8818 | /* 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] | 8819 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8820 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8821 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8822 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8823 | { } |
| 8824 | }; |
| 8825 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8826 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8827 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8828 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8829 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8830 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8831 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8832 | { } /* end */ |
| 8833 | }; |
| 8834 | |
| 8835 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8836 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8837 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8838 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8839 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8840 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8841 | { } /* end */ |
| 8842 | }; |
| 8843 | |
| 8844 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8845 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8846 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8847 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8848 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8849 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8850 | { } /* end */ |
| 8851 | }; |
| 8852 | |
| 8853 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8854 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8855 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8856 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8857 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8858 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8859 | { } /* end */ |
| 8860 | }; |
| 8861 | |
| 8862 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8863 | { 2, alc889A_mb31_ch2_init }, |
| 8864 | { 4, alc889A_mb31_ch4_init }, |
| 8865 | { 5, alc889A_mb31_ch5_init }, |
| 8866 | { 6, alc889A_mb31_ch6_init }, |
| 8867 | }; |
| 8868 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8869 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8870 | /* eanable EAPD on medion laptop */ |
| 8871 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8872 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8873 | { } |
| 8874 | }; |
| 8875 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8876 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8877 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8878 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8879 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8880 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8881 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8882 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8883 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8884 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8885 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8886 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8887 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8888 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8889 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8890 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8891 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8892 | { } /* end */ |
| 8893 | }; |
| 8894 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8895 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8896 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8897 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8898 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8899 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8900 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8901 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8902 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8903 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8904 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8905 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8906 | { } /* end */ |
| 8907 | }; |
| 8908 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8909 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8910 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8911 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8912 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8913 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8914 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8915 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8916 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8917 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8918 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8919 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8920 | { } /* end */ |
| 8921 | }; |
| 8922 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8923 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8924 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8925 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8926 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8927 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8928 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8929 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8930 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8931 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8932 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8933 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8934 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8935 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8936 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8937 | { } /* end */ |
| 8938 | }; |
| 8939 | |
| 8940 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8941 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8942 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8943 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8944 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8945 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8946 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8947 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8948 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8949 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8950 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8951 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8952 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8953 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8954 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8955 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8956 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8957 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8958 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8959 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8960 | { } /* end */ |
| 8961 | }; |
| 8962 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8963 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8964 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8965 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8966 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8967 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8968 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8969 | 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", 0x15, 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, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8979 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8981 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8982 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8983 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8984 | { } /* end */ |
| 8985 | }; |
| 8986 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8987 | static struct snd_kcontrol_new alc885_8ch_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_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8998 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8999 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 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, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9003 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, 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), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9007 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9008 | { } /* end */ |
| 9009 | }; |
| 9010 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 9011 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9012 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9013 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9014 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9015 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9016 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9017 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9018 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9019 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9020 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9021 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9022 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9023 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9024 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9025 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9026 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9027 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9028 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9029 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9030 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9031 | { } /* end */ |
| 9032 | }; |
| 9033 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9034 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9035 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9036 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9037 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9038 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9039 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9040 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9041 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9042 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9043 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9044 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 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), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9051 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9052 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9053 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9054 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9055 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9056 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9057 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9058 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9059 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9060 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9061 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9063 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9064 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9065 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9066 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9067 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9068 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9069 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9070 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9071 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 9072 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9073 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9074 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9075 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9076 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9077 | { } /* end */ |
| 9078 | }; |
| 9079 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9080 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9081 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9082 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9083 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9084 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9085 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9086 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, 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 | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9088 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9089 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9090 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9091 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9092 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9093 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9094 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9095 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9096 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9097 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9098 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9099 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9100 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9101 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9102 | { } /* end */ |
| 9103 | }; |
| 9104 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9105 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9106 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9107 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9108 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9109 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9110 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9111 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9112 | { } /* end */ |
| 9113 | }; |
| 9114 | |
| 9115 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9116 | /* Unmute front mixer */ |
| 9117 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9118 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9119 | |
| 9120 | /* Set speaker pin to front mixer */ |
| 9121 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9122 | |
| 9123 | /* Init headphone pin */ |
| 9124 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9125 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9126 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9127 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9128 | |
| 9129 | { } /* end */ |
| 9130 | }; |
| 9131 | |
| 9132 | /* toggle speaker-output according to the hp-jack state */ |
| 9133 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9134 | { |
| 9135 | struct alc_spec *spec = codec->spec; |
| 9136 | |
| 9137 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9138 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9139 | } |
| 9140 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9141 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9142 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9143 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9144 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9145 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9146 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9147 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9148 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9149 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9150 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9151 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9152 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9153 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9154 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9155 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9156 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9157 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9158 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9159 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9160 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9161 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9162 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9163 | { } /* end */ |
| 9164 | }; |
| 9165 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9166 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9167 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9168 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9169 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9170 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9171 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9172 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9173 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9174 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9175 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9176 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9177 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9178 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9179 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9180 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9181 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9182 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9183 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9184 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9185 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9186 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9187 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9188 | { } /* end */ |
| 9189 | }; |
| 9190 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9191 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9192 | /* Output mixers */ |
| 9193 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9194 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9195 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9196 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9197 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9198 | HDA_OUTPUT), |
| 9199 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9200 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9201 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9202 | /* Output switches */ |
| 9203 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9204 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9205 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9206 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9207 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9208 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9209 | /* Input mixers */ |
| 9210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9212 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9213 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9214 | { } /* end */ |
| 9215 | }; |
| 9216 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9217 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9218 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9219 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9220 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9222 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9223 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9224 | { } /* end */ |
| 9225 | }; |
| 9226 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9227 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9228 | .ops = &snd_hda_bind_vol, |
| 9229 | .values = { |
| 9230 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9231 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9232 | 0 |
| 9233 | }, |
| 9234 | }; |
| 9235 | |
| 9236 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9237 | .ops = &snd_hda_bind_sw, |
| 9238 | .values = { |
| 9239 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9240 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9241 | 0 |
| 9242 | }, |
| 9243 | }; |
| 9244 | |
| 9245 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9246 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9247 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9248 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9249 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9250 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9251 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9252 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9253 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9254 | { } /* end */ |
| 9255 | }; |
| 9256 | |
| 9257 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9258 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9259 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9260 | { |
| 9261 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9262 | /* .name = "Capture Source", */ |
| 9263 | .name = "Input Source", |
| 9264 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9265 | .info = alc_mux_enum_info, |
| 9266 | .get = alc_mux_enum_get, |
| 9267 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9268 | }, |
| 9269 | { } /* end */ |
| 9270 | }; |
| 9271 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9272 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9273 | { |
| 9274 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9275 | .name = "Channel Mode", |
| 9276 | .info = alc_ch_mode_info, |
| 9277 | .get = alc_ch_mode_get, |
| 9278 | .put = alc_ch_mode_put, |
| 9279 | }, |
| 9280 | { } /* end */ |
| 9281 | }; |
| 9282 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9283 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9284 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9285 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9286 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9287 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9288 | spec->autocfg.hp_pins[0] = 0x15; |
| 9289 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9290 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9291 | } |
| 9292 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9293 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9294 | /* HP */ |
| 9295 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9296 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9297 | /* Subwoofer */ |
| 9298 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9299 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9300 | |
| 9301 | /* enable unsolicited event */ |
| 9302 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9303 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9304 | |
| 9305 | { } /* end */ |
| 9306 | }; |
| 9307 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9308 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9309 | /* HP */ |
| 9310 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9311 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9312 | /* Int speaker */ |
| 9313 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9314 | |
| 9315 | /* enable unsolicited event */ |
| 9316 | /* |
| 9317 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9318 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9319 | */ |
| 9320 | |
| 9321 | { } /* end */ |
| 9322 | }; |
| 9323 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9324 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9325 | /* HP */ |
| 9326 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9327 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9328 | /* Int speaker */ |
| 9329 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9330 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9331 | |
| 9332 | /* enable unsolicited event */ |
| 9333 | {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] | 9334 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9335 | |
| 9336 | { } /* end */ |
| 9337 | }; |
| 9338 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9339 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9340 | /* HP */ |
| 9341 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9342 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9343 | /* Subwoofer */ |
| 9344 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9345 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9346 | |
| 9347 | /* enable unsolicited event */ |
| 9348 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9349 | |
| 9350 | { } /* end */ |
| 9351 | }; |
| 9352 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9353 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9354 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9355 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9356 | |
| 9357 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9358 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9359 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9360 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9361 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9362 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9363 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9364 | /* Connect Mic jack to CLFE */ |
| 9365 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9366 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9367 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9368 | /* Connect Line-in jack to Surround */ |
| 9369 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9370 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9371 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9372 | /* Connect HP out jack to Front */ |
| 9373 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9374 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9375 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9376 | |
| 9377 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9378 | |
| 9379 | { } /* end */ |
| 9380 | }; |
| 9381 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9382 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9383 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9384 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9385 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9386 | { } /* end */ |
| 9387 | }; |
| 9388 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9389 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9390 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9392 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9393 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9394 | { } /* end */ |
| 9395 | }; |
| 9396 | |
| 9397 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9398 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9399 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9400 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9401 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9402 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9403 | { } /* end */ |
| 9404 | }; |
| 9405 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9406 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9407 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9408 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9409 | |
| 9410 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9411 | |
| 9412 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9413 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9414 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9415 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9416 | { } /* end */ |
| 9417 | }; |
| 9418 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9419 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9420 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9421 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9422 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9423 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9424 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9425 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9426 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9427 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9428 | { } /* end */ |
| 9429 | }; |
| 9430 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9431 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9432 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9433 | { } |
| 9434 | }; |
| 9435 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9436 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9437 | /* HP */ |
| 9438 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9439 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9440 | |
| 9441 | /* enable unsolicited event */ |
| 9442 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9443 | |
| 9444 | { } /* end */ |
| 9445 | }; |
| 9446 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9447 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9448 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9449 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9450 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9451 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9452 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9453 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9454 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9455 | } |
| 9456 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9457 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9458 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9459 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9460 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9461 | {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] | 9462 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9463 | }; |
| 9464 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9465 | /* |
| 9466 | * 2ch mode |
| 9467 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9468 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9469 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9470 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9471 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9472 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9473 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9474 | }; |
| 9475 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9476 | /* |
| 9477 | * 4ch mode |
| 9478 | */ |
| 9479 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9480 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9481 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9482 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9483 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9484 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9485 | { } /* end */ |
| 9486 | }; |
| 9487 | |
| 9488 | /* |
| 9489 | * 6ch mode |
| 9490 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9491 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9492 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9493 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9494 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9495 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9496 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9497 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9498 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9499 | }; |
| 9500 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9501 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9502 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9503 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9504 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9505 | }; |
| 9506 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9507 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9508 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9509 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9510 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9511 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9512 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9513 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9514 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9515 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9516 | } |
| 9517 | |
| 9518 | /* toggle RCA according to the front-jack state */ |
| 9519 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9520 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9521 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9522 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9523 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9524 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9525 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9526 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9527 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9528 | unsigned int res) |
| 9529 | { |
| 9530 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9531 | alc888_lenovo_ms7195_front_automute(codec); |
| 9532 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9533 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9534 | } |
| 9535 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9536 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9537 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9538 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9539 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9540 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9541 | spec->autocfg.hp_pins[0] = 0x14; |
| 9542 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9543 | } |
| 9544 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9545 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9546 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9547 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9548 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9549 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9550 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9551 | struct alc_spec *spec = codec->spec; |
| 9552 | |
| 9553 | spec->autocfg.hp_pins[0] = 0x15; |
| 9554 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9555 | } |
| 9556 | |
| 9557 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9558 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9559 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9560 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9561 | } |
| 9562 | |
| 9563 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9564 | unsigned int res) |
| 9565 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9566 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9567 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9568 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9569 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9570 | default: |
| 9571 | alc_automute_amp_unsol_event(codec, res); |
| 9572 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9573 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9574 | } |
| 9575 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9576 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9577 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9578 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9579 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9580 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9581 | spec->autocfg.hp_pins[0] = 0x14; |
| 9582 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9583 | } |
| 9584 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9585 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9586 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9587 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9588 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9589 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9590 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9591 | } |
| 9592 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9593 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9594 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9595 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9596 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9597 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9598 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9599 | } |
| 9600 | |
| 9601 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9602 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9603 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9604 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9605 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9606 | HDA_AMP_MUTE, bits); |
| 9607 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9608 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9609 | } |
| 9610 | |
| 9611 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9612 | unsigned int res) |
| 9613 | { |
| 9614 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9615 | alc883_lenovo_101e_all_automute(codec); |
| 9616 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9617 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9618 | } |
| 9619 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9620 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9621 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9622 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9623 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9624 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9625 | spec->autocfg.hp_pins[0] = 0x14; |
| 9626 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9627 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9628 | } |
| 9629 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9630 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9631 | /* HP Pin: output 0 (0x0c) */ |
| 9632 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9633 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9634 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9635 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9636 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9637 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9638 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9639 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9640 | /* eanable EAPD on medion laptop */ |
| 9641 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9642 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9643 | /* enable unsolicited event */ |
| 9644 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9645 | { } |
| 9646 | }; |
| 9647 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9648 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9649 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9650 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9651 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9652 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9653 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9654 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9655 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9656 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9657 | } |
| 9658 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9659 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9660 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9661 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9662 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9663 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9664 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9665 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9666 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9667 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9668 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9669 | } |
| 9670 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9671 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9672 | { |
| 9673 | struct alc_spec *spec = codec->spec; |
| 9674 | |
| 9675 | spec->autocfg.hp_pins[0] = 0x15; |
| 9676 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9677 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9678 | } |
| 9679 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9680 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9681 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9682 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9683 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9684 | /* enable unsolicited event */ |
| 9685 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9686 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9687 | { } /* end */ |
| 9688 | }; |
| 9689 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9690 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9691 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9692 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9693 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9694 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9695 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9696 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9697 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9698 | spec->ext_mic.pin = 0x18; |
| 9699 | spec->int_mic.pin = 0x19; |
| 9700 | spec->ext_mic.mux_idx = 0; |
| 9701 | spec->int_mic.mux_idx = 1; |
| 9702 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9703 | } |
| 9704 | |
| 9705 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9706 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9707 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9708 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9709 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9710 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9711 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9712 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9713 | /* enable unsolicited event */ |
| 9714 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9715 | { } /* end */ |
| 9716 | }; |
| 9717 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9718 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9719 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9720 | struct alc_spec *spec = codec->spec; |
| 9721 | |
| 9722 | spec->autocfg.hp_pins[0] = 0x14; |
| 9723 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9724 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9725 | } |
| 9726 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9727 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9728 | /* Init rear pin (used as headphone output) */ |
| 9729 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9730 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9731 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9732 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9733 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9734 | /* Init line 2 pin (used as headphone out by default) */ |
| 9735 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9736 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9737 | { } /* end */ |
| 9738 | }; |
| 9739 | |
| 9740 | /* Mute speakers according to the headphone jack state */ |
| 9741 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9742 | { |
| 9743 | unsigned int present; |
| 9744 | |
| 9745 | /* Mute only in 2ch or 4ch mode */ |
| 9746 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9747 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9748 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9749 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9750 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9751 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9752 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9753 | } |
| 9754 | } |
| 9755 | |
| 9756 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9757 | { |
| 9758 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9759 | alc889A_mb31_automute(codec); |
| 9760 | } |
| 9761 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9762 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9763 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9764 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9765 | #endif |
| 9766 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9767 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9768 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9769 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9770 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9771 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9772 | |
| 9773 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9774 | ALC1200_DIGOUT_NID, 0, |
| 9775 | }; |
| 9776 | |
| 9777 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9778 | ALC883_DIGOUT_NID, 0, |
| 9779 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9780 | |
| 9781 | /* |
| 9782 | * configuration and preset |
| 9783 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9784 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9785 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9786 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9787 | [ALC882_ARIMA] = "arima", |
| 9788 | [ALC882_W2JC] = "w2jc", |
| 9789 | [ALC882_TARGA] = "targa", |
| 9790 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9791 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9792 | [ALC885_MACPRO] = "macpro", |
| 9793 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9794 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9795 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9796 | [ALC885_MBP3] = "mbp3", |
| 9797 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9798 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9799 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9800 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9801 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9802 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9803 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9804 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9805 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9806 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9807 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9808 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9809 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9810 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9811 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9812 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9813 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9814 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9815 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9816 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9817 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9818 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9819 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9820 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9821 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9822 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9823 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9824 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9825 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9826 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9827 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9828 | [ALC889A_INTEL] = "intel-alc889a", |
| 9829 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9830 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9831 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9832 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9833 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9834 | }; |
| 9835 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9836 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9837 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9838 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9839 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9840 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9841 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9842 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9843 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9844 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9845 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9846 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9847 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9848 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9849 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9850 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9851 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9852 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9853 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9854 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9855 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9856 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9857 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9858 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9859 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9860 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9861 | /* default Acer -- disabled as it causes more problems. |
| 9862 | * model=auto should work fine now |
| 9863 | */ |
| 9864 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9865 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9866 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9867 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9868 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9869 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9870 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9871 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9872 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9873 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9874 | |
| 9875 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9876 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9877 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9878 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9879 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9880 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9881 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9882 | 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] | 9883 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9884 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9885 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9886 | |
| 9887 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9888 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9889 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9890 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9891 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9892 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9893 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9894 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9895 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9896 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9897 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9898 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9899 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9900 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9901 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9902 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9903 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9904 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9905 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9906 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9907 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9908 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9909 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9910 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9911 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9912 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9913 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9914 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9915 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9916 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9917 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9918 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9919 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9920 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9921 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9922 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9923 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9924 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9925 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9926 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9927 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9928 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9929 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9930 | 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] | 9931 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9932 | 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] | 9933 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9934 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9935 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9936 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9937 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9938 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9939 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9940 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9941 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9942 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9943 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9944 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9945 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9946 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9947 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9948 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9949 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9950 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9951 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9952 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9953 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9954 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9955 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9956 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9957 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9958 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9959 | {} |
| 9960 | }; |
| 9961 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9962 | /* codec SSID table for Intel Mac */ |
| 9963 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9964 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9965 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9966 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9967 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9968 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9969 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9970 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9971 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9972 | 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] | 9973 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9974 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9975 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9976 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9977 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9978 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9979 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9980 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9981 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9982 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9983 | */ |
| 9984 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9985 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9986 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9987 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9988 | }; |
| 9989 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9990 | static struct alc_config_preset alc882_presets[] = { |
| 9991 | [ALC882_3ST_DIG] = { |
| 9992 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9993 | .init_verbs = { alc882_base_init_verbs, |
| 9994 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9995 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9996 | .dac_nids = alc882_dac_nids, |
| 9997 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9998 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9999 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10000 | .channel_mode = alc882_ch_modes, |
| 10001 | .need_dac_fix = 1, |
| 10002 | .input_mux = &alc882_capture_source, |
| 10003 | }, |
| 10004 | [ALC882_6ST_DIG] = { |
| 10005 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10006 | .init_verbs = { alc882_base_init_verbs, |
| 10007 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10008 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10009 | .dac_nids = alc882_dac_nids, |
| 10010 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10011 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10012 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10013 | .channel_mode = alc882_sixstack_modes, |
| 10014 | .input_mux = &alc882_capture_source, |
| 10015 | }, |
| 10016 | [ALC882_ARIMA] = { |
| 10017 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10018 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10019 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10020 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10021 | .dac_nids = alc882_dac_nids, |
| 10022 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10023 | .channel_mode = alc882_sixstack_modes, |
| 10024 | .input_mux = &alc882_capture_source, |
| 10025 | }, |
| 10026 | [ALC882_W2JC] = { |
| 10027 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10028 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10029 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10030 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10031 | .dac_nids = alc882_dac_nids, |
| 10032 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10033 | .channel_mode = alc880_threestack_modes, |
| 10034 | .need_dac_fix = 1, |
| 10035 | .input_mux = &alc882_capture_source, |
| 10036 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10037 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10038 | [ALC885_MBA21] = { |
| 10039 | .mixers = { alc885_mba21_mixer }, |
| 10040 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10041 | .num_dacs = 2, |
| 10042 | .dac_nids = alc882_dac_nids, |
| 10043 | .channel_mode = alc885_mba21_ch_modes, |
| 10044 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10045 | .input_mux = &alc882_capture_source, |
| 10046 | .unsol_event = alc_automute_amp_unsol_event, |
| 10047 | .setup = alc885_mba21_setup, |
| 10048 | .init_hook = alc_automute_amp, |
| 10049 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10050 | [ALC885_MBP3] = { |
| 10051 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10052 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10053 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10054 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10055 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10056 | .hp_nid = 0x04, |
| 10057 | .channel_mode = alc885_mbp_4ch_modes, |
| 10058 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10059 | .input_mux = &alc882_capture_source, |
| 10060 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10061 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10062 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10063 | .setup = alc885_mbp3_setup, |
| 10064 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10065 | }, |
| 10066 | [ALC885_MB5] = { |
| 10067 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10068 | .init_verbs = { alc885_mb5_init_verbs, |
| 10069 | alc880_gpio1_init_verbs }, |
| 10070 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10071 | .dac_nids = alc882_dac_nids, |
| 10072 | .channel_mode = alc885_mb5_6ch_modes, |
| 10073 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10074 | .input_mux = &mb5_capture_source, |
| 10075 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10076 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10077 | .unsol_event = alc_automute_amp_unsol_event, |
| 10078 | .setup = alc885_mb5_setup, |
| 10079 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10080 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10081 | [ALC885_MACMINI3] = { |
| 10082 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10083 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10084 | alc880_gpio1_init_verbs }, |
| 10085 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10086 | .dac_nids = alc882_dac_nids, |
| 10087 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10088 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10089 | .input_mux = &macmini3_capture_source, |
| 10090 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10091 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10092 | .unsol_event = alc_automute_amp_unsol_event, |
| 10093 | .setup = alc885_macmini3_setup, |
| 10094 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10095 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10096 | [ALC885_MACPRO] = { |
| 10097 | .mixers = { alc882_macpro_mixer }, |
| 10098 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10099 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10100 | .dac_nids = alc882_dac_nids, |
| 10101 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10102 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10103 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10104 | .channel_mode = alc882_ch_modes, |
| 10105 | .input_mux = &alc882_capture_source, |
| 10106 | .init_hook = alc885_macpro_init_hook, |
| 10107 | }, |
| 10108 | [ALC885_IMAC24] = { |
| 10109 | .mixers = { alc885_imac24_mixer }, |
| 10110 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10111 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10112 | .dac_nids = alc882_dac_nids, |
| 10113 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10114 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10115 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10116 | .channel_mode = alc882_ch_modes, |
| 10117 | .input_mux = &alc882_capture_source, |
| 10118 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10119 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10120 | .init_hook = alc885_imac24_init_hook, |
| 10121 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10122 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10123 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10124 | .init_verbs = { alc885_imac91_init_verbs, |
| 10125 | alc880_gpio1_init_verbs }, |
| 10126 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10127 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10128 | .channel_mode = alc885_mba21_ch_modes, |
| 10129 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10130 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10131 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10132 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10133 | .unsol_event = alc_automute_amp_unsol_event, |
| 10134 | .setup = alc885_imac91_setup, |
| 10135 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10136 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10137 | [ALC882_TARGA] = { |
| 10138 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10139 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10140 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10141 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10142 | .dac_nids = alc882_dac_nids, |
| 10143 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10144 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10145 | .adc_nids = alc882_adc_nids, |
| 10146 | .capsrc_nids = alc882_capsrc_nids, |
| 10147 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10148 | .channel_mode = alc882_3ST_6ch_modes, |
| 10149 | .need_dac_fix = 1, |
| 10150 | .input_mux = &alc882_capture_source, |
| 10151 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10152 | .setup = alc882_targa_setup, |
| 10153 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10154 | }, |
| 10155 | [ALC882_ASUS_A7J] = { |
| 10156 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10157 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10158 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10159 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10160 | .dac_nids = alc882_dac_nids, |
| 10161 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10162 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10163 | .adc_nids = alc882_adc_nids, |
| 10164 | .capsrc_nids = alc882_capsrc_nids, |
| 10165 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10166 | .channel_mode = alc882_3ST_6ch_modes, |
| 10167 | .need_dac_fix = 1, |
| 10168 | .input_mux = &alc882_capture_source, |
| 10169 | }, |
| 10170 | [ALC882_ASUS_A7M] = { |
| 10171 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10172 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10173 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10174 | alc882_asus_a7m_verbs }, |
| 10175 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10176 | .dac_nids = alc882_dac_nids, |
| 10177 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10178 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10179 | .channel_mode = alc880_threestack_modes, |
| 10180 | .need_dac_fix = 1, |
| 10181 | .input_mux = &alc882_capture_source, |
| 10182 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10183 | [ALC883_3ST_2ch_DIG] = { |
| 10184 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10185 | .init_verbs = { alc883_init_verbs }, |
| 10186 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10187 | .dac_nids = alc883_dac_nids, |
| 10188 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10189 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10190 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10191 | .channel_mode = alc883_3ST_2ch_modes, |
| 10192 | .input_mux = &alc883_capture_source, |
| 10193 | }, |
| 10194 | [ALC883_3ST_6ch_DIG] = { |
| 10195 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10196 | .init_verbs = { alc883_init_verbs }, |
| 10197 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10198 | .dac_nids = alc883_dac_nids, |
| 10199 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10200 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10201 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10202 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10203 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10204 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10205 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10206 | [ALC883_3ST_6ch] = { |
| 10207 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10208 | .init_verbs = { alc883_init_verbs }, |
| 10209 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10210 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10211 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10212 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10213 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10214 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10215 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10216 | [ALC883_3ST_6ch_INTEL] = { |
| 10217 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10218 | .init_verbs = { alc883_init_verbs }, |
| 10219 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10220 | .dac_nids = alc883_dac_nids, |
| 10221 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10222 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10223 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10224 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10225 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10226 | .need_dac_fix = 1, |
| 10227 | .input_mux = &alc883_3stack_6ch_intel, |
| 10228 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10229 | [ALC889A_INTEL] = { |
| 10230 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10231 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10232 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10233 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10234 | .dac_nids = alc883_dac_nids, |
| 10235 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10236 | .adc_nids = alc889_adc_nids, |
| 10237 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10238 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10239 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10240 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10241 | .channel_mode = alc889_8ch_intel_modes, |
| 10242 | .capsrc_nids = alc889_capsrc_nids, |
| 10243 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10244 | .setup = alc889_automute_setup, |
| 10245 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10246 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10247 | .need_dac_fix = 1, |
| 10248 | }, |
| 10249 | [ALC889_INTEL] = { |
| 10250 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10251 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10252 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10253 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10254 | .dac_nids = alc883_dac_nids, |
| 10255 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10256 | .adc_nids = alc889_adc_nids, |
| 10257 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10258 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10259 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10260 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10261 | .channel_mode = alc889_8ch_intel_modes, |
| 10262 | .capsrc_nids = alc889_capsrc_nids, |
| 10263 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10264 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10265 | .init_hook = alc889_intel_init_hook, |
| 10266 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10267 | .need_dac_fix = 1, |
| 10268 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10269 | [ALC883_6ST_DIG] = { |
| 10270 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10271 | .init_verbs = { alc883_init_verbs }, |
| 10272 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10273 | .dac_nids = alc883_dac_nids, |
| 10274 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10275 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10276 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10277 | .channel_mode = alc883_sixstack_modes, |
| 10278 | .input_mux = &alc883_capture_source, |
| 10279 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10280 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10281 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10282 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10283 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10284 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10285 | .dac_nids = alc883_dac_nids, |
| 10286 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10287 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10288 | .channel_mode = alc883_3ST_6ch_modes, |
| 10289 | .need_dac_fix = 1, |
| 10290 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10291 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10292 | .setup = alc882_targa_setup, |
| 10293 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10294 | }, |
| 10295 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10296 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10297 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10298 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10299 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10300 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10301 | .adc_nids = alc883_adc_nids_alt, |
| 10302 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10303 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10304 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10305 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10306 | .channel_mode = alc883_3ST_2ch_modes, |
| 10307 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10308 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10309 | .setup = alc882_targa_setup, |
| 10310 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10311 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10312 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10313 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10314 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10315 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10316 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10317 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10318 | .dac_nids = alc883_dac_nids, |
| 10319 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10320 | .adc_nids = alc883_adc_nids_rev, |
| 10321 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10322 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10323 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10324 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10325 | .channel_mode = alc883_4ST_8ch_modes, |
| 10326 | .need_dac_fix = 1, |
| 10327 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10328 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10329 | .setup = alc882_targa_setup, |
| 10330 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10331 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10332 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10333 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10334 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10335 | * and the headphone jack. Turn this on and rely on the |
| 10336 | * standard mute methods whenever the user wants to turn |
| 10337 | * these outputs off. |
| 10338 | */ |
| 10339 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10340 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10341 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10342 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10343 | .channel_mode = alc883_3ST_2ch_modes, |
| 10344 | .input_mux = &alc883_capture_source, |
| 10345 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10346 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10347 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10348 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10349 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10350 | .dac_nids = alc883_dac_nids, |
| 10351 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10352 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10353 | .channel_mode = alc883_3ST_2ch_modes, |
| 10354 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10355 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10356 | .setup = alc883_acer_aspire_setup, |
| 10357 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10358 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10359 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10360 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10361 | alc883_chmode_mixer }, |
| 10362 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10363 | alc888_acer_aspire_4930g_verbs }, |
| 10364 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10365 | .dac_nids = alc883_dac_nids, |
| 10366 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10367 | .adc_nids = alc883_adc_nids_rev, |
| 10368 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10369 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10370 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10371 | .channel_mode = alc883_3ST_6ch_modes, |
| 10372 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10373 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10374 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10375 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10376 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10377 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10378 | .setup = alc888_acer_aspire_4930g_setup, |
| 10379 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10380 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10381 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10382 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10383 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10384 | alc888_acer_aspire_6530g_verbs }, |
| 10385 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10386 | .dac_nids = alc883_dac_nids, |
| 10387 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10388 | .adc_nids = alc883_adc_nids_rev, |
| 10389 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10390 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10391 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10392 | .channel_mode = alc883_3ST_2ch_modes, |
| 10393 | .num_mux_defs = |
| 10394 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10395 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10396 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10397 | .setup = alc888_acer_aspire_6530g_setup, |
| 10398 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10399 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10400 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10401 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10402 | alc883_chmode_mixer }, |
| 10403 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10404 | alc889_acer_aspire_8930g_verbs, |
| 10405 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10406 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10407 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10408 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10409 | .adc_nids = alc889_adc_nids, |
| 10410 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10411 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10412 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10413 | .channel_mode = alc883_3ST_6ch_modes, |
| 10414 | .need_dac_fix = 1, |
| 10415 | .const_channel_count = 6, |
| 10416 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10417 | ARRAY_SIZE(alc889_capture_sources), |
| 10418 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10419 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10420 | .setup = alc889_acer_aspire_8930g_setup, |
| 10421 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10422 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10423 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10424 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10425 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10426 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10427 | .mixers = { alc883_3ST_6ch_mixer, |
| 10428 | alc883_chmode_mixer }, |
| 10429 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10430 | alc888_acer_aspire_7730G_verbs }, |
| 10431 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10432 | .dac_nids = alc883_dac_nids, |
| 10433 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10434 | .adc_nids = alc883_adc_nids_rev, |
| 10435 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10436 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10437 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10438 | .channel_mode = alc883_3ST_6ch_modes, |
| 10439 | .need_dac_fix = 1, |
| 10440 | .const_channel_count = 6, |
| 10441 | .input_mux = &alc883_capture_source, |
| 10442 | .unsol_event = alc_automute_amp_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10443 | .setup = alc888_acer_aspire_7730g_setup, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10444 | .init_hook = alc_automute_amp, |
| 10445 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10446 | [ALC883_MEDION] = { |
| 10447 | .mixers = { alc883_fivestack_mixer, |
| 10448 | alc883_chmode_mixer }, |
| 10449 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10450 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10451 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10452 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10453 | .adc_nids = alc883_adc_nids_alt, |
| 10454 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10455 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10456 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10457 | .channel_mode = alc883_sixstack_modes, |
| 10458 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10459 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10460 | [ALC883_MEDION_WIM2160] = { |
| 10461 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10462 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10463 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10464 | .dac_nids = alc883_dac_nids, |
| 10465 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10466 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10467 | .adc_nids = alc883_adc_nids, |
| 10468 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10469 | .channel_mode = alc883_3ST_2ch_modes, |
| 10470 | .input_mux = &alc883_capture_source, |
| 10471 | .unsol_event = alc_automute_amp_unsol_event, |
| 10472 | .setup = alc883_medion_wim2160_setup, |
| 10473 | .init_hook = alc_automute_amp, |
| 10474 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10475 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10476 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10477 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10478 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10479 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10480 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10481 | .channel_mode = alc883_3ST_2ch_modes, |
| 10482 | .input_mux = &alc883_capture_source, |
| 10483 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10484 | [ALC883_CLEVO_M540R] = { |
| 10485 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10486 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10487 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10488 | .dac_nids = alc883_dac_nids, |
| 10489 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10490 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10491 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10492 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10493 | .need_dac_fix = 1, |
| 10494 | .input_mux = &alc883_capture_source, |
| 10495 | /* This machine has the hardware HP auto-muting, thus |
| 10496 | * we need no software mute via unsol event |
| 10497 | */ |
| 10498 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10499 | [ALC883_CLEVO_M720] = { |
| 10500 | .mixers = { alc883_clevo_m720_mixer }, |
| 10501 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10502 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10503 | .dac_nids = alc883_dac_nids, |
| 10504 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10505 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10506 | .channel_mode = alc883_3ST_2ch_modes, |
| 10507 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10508 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10509 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10510 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10511 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10512 | [ALC883_LENOVO_101E_2ch] = { |
| 10513 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10514 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10515 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10516 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10517 | .adc_nids = alc883_adc_nids_alt, |
| 10518 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10519 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10520 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10521 | .channel_mode = alc883_3ST_2ch_modes, |
| 10522 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10523 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10524 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10525 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10526 | [ALC883_LENOVO_NB0763] = { |
| 10527 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10528 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10529 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10530 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10531 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10532 | .channel_mode = alc883_3ST_2ch_modes, |
| 10533 | .need_dac_fix = 1, |
| 10534 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10535 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10536 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10537 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10538 | }, |
| 10539 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10540 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10541 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10542 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10543 | .dac_nids = alc883_dac_nids, |
| 10544 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10545 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10546 | .channel_mode = alc883_3ST_6ch_modes, |
| 10547 | .need_dac_fix = 1, |
| 10548 | .input_mux = &alc883_capture_source, |
| 10549 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10550 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10551 | }, |
| 10552 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10553 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10554 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10555 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10556 | .dac_nids = alc883_dac_nids, |
| 10557 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10558 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10559 | .channel_mode = alc883_3ST_2ch_modes, |
| 10560 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10561 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10562 | .setup = alc883_haier_w66_setup, |
| 10563 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10564 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10565 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10566 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10567 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10568 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10569 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10570 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10571 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10572 | .need_dac_fix = 1, |
| 10573 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10574 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10575 | .setup = alc888_3st_hp_setup, |
| 10576 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10577 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10578 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10579 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10580 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10581 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10582 | .dac_nids = alc883_dac_nids, |
| 10583 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10584 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10585 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10586 | .channel_mode = alc883_sixstack_modes, |
| 10587 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10588 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10589 | .setup = alc888_6st_dell_setup, |
| 10590 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10591 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10592 | [ALC883_MITAC] = { |
| 10593 | .mixers = { alc883_mitac_mixer }, |
| 10594 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10595 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10596 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10597 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10598 | .channel_mode = alc883_3ST_2ch_modes, |
| 10599 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10600 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10601 | .setup = alc883_mitac_setup, |
| 10602 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10603 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10604 | [ALC883_FUJITSU_PI2515] = { |
| 10605 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10606 | .init_verbs = { alc883_init_verbs, |
| 10607 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10608 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10609 | .dac_nids = alc883_dac_nids, |
| 10610 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10611 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10612 | .channel_mode = alc883_3ST_2ch_modes, |
| 10613 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10614 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10615 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10616 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10617 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10618 | [ALC888_FUJITSU_XA3530] = { |
| 10619 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10620 | .init_verbs = { alc883_init_verbs, |
| 10621 | alc888_fujitsu_xa3530_verbs }, |
| 10622 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10623 | .dac_nids = alc883_dac_nids, |
| 10624 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10625 | .adc_nids = alc883_adc_nids_rev, |
| 10626 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10627 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10628 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10629 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10630 | .num_mux_defs = |
| 10631 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10632 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10633 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10634 | .setup = alc888_fujitsu_xa3530_setup, |
| 10635 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10636 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10637 | [ALC888_LENOVO_SKY] = { |
| 10638 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10639 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10640 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10641 | .dac_nids = alc883_dac_nids, |
| 10642 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10643 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10644 | .channel_mode = alc883_sixstack_modes, |
| 10645 | .need_dac_fix = 1, |
| 10646 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10647 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10648 | .setup = alc888_lenovo_sky_setup, |
| 10649 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10650 | }, |
| 10651 | [ALC888_ASUS_M90V] = { |
| 10652 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10653 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10654 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10655 | .dac_nids = alc883_dac_nids, |
| 10656 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10657 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10658 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10659 | .channel_mode = alc883_3ST_6ch_modes, |
| 10660 | .need_dac_fix = 1, |
| 10661 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10662 | .unsol_event = alc_sku_unsol_event, |
| 10663 | .setup = alc883_mode2_setup, |
| 10664 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10665 | }, |
| 10666 | [ALC888_ASUS_EEE1601] = { |
| 10667 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10668 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10669 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10670 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10671 | .dac_nids = alc883_dac_nids, |
| 10672 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10673 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10674 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10675 | .channel_mode = alc883_3ST_2ch_modes, |
| 10676 | .need_dac_fix = 1, |
| 10677 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10678 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10679 | .init_hook = alc883_eee1601_inithook, |
| 10680 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10681 | [ALC1200_ASUS_P5Q] = { |
| 10682 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10683 | .init_verbs = { alc883_init_verbs }, |
| 10684 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10685 | .dac_nids = alc883_dac_nids, |
| 10686 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10687 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10688 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10689 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10690 | .channel_mode = alc883_sixstack_modes, |
| 10691 | .input_mux = &alc883_capture_source, |
| 10692 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10693 | [ALC889A_MB31] = { |
| 10694 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10695 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10696 | alc880_gpio1_init_verbs }, |
| 10697 | .adc_nids = alc883_adc_nids, |
| 10698 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10699 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10700 | .dac_nids = alc883_dac_nids, |
| 10701 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10702 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10703 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10704 | .input_mux = &alc889A_mb31_capture_source, |
| 10705 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10706 | .unsol_event = alc889A_mb31_unsol_event, |
| 10707 | .init_hook = alc889A_mb31_automute, |
| 10708 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10709 | [ALC883_SONY_VAIO_TT] = { |
| 10710 | .mixers = { alc883_vaiott_mixer }, |
| 10711 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10712 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10713 | .dac_nids = alc883_dac_nids, |
| 10714 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10715 | .channel_mode = alc883_3ST_2ch_modes, |
| 10716 | .input_mux = &alc883_capture_source, |
| 10717 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10718 | .setup = alc883_vaiott_setup, |
| 10719 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10720 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10721 | }; |
| 10722 | |
| 10723 | |
| 10724 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10725 | * Pin config fixes |
| 10726 | */ |
| 10727 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10728 | PINFIX_ABIT_AW9D_MAX, |
| 10729 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10730 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10731 | }; |
| 10732 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10733 | static const struct alc_fixup alc882_fixups[] = { |
| 10734 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10735 | .type = ALC_FIXUP_PINS, |
| 10736 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10737 | { 0x15, 0x01080104 }, /* side */ |
| 10738 | { 0x16, 0x01011012 }, /* rear */ |
| 10739 | { 0x17, 0x01016011 }, /* clfe */ |
| 10740 | { } |
| 10741 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10742 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10743 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10744 | .type = ALC_FIXUP_VERBS, |
| 10745 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10746 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10747 | {} |
| 10748 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10749 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10750 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10751 | .type = ALC_FIXUP_SKU, |
| 10752 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10753 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10754 | }; |
| 10755 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10756 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10757 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10758 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10759 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10760 | {} |
| 10761 | }; |
| 10762 | |
| 10763 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10764 | * BIOS auto configuration |
| 10765 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10766 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10767 | const struct auto_pin_cfg *cfg) |
| 10768 | { |
| 10769 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10770 | } |
| 10771 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10772 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10773 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10774 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10775 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10776 | int idx; |
| 10777 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10778 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10779 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10780 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10781 | if (dac == 0x25) |
| 10782 | idx = 4; |
| 10783 | else if (dac >= 0x02 && dac <= 0x05) |
| 10784 | idx = dac - 2; |
| 10785 | else |
| 10786 | return; |
| 10787 | 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] | 10788 | } |
| 10789 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10790 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10791 | { |
| 10792 | struct alc_spec *spec = codec->spec; |
| 10793 | int i; |
| 10794 | |
| 10795 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10796 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10797 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10798 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10799 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10800 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10801 | } |
| 10802 | } |
| 10803 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10804 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10805 | { |
| 10806 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10807 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10808 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10809 | |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10810 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10811 | pin = spec->autocfg.hp_pins[i]; |
| 10812 | if (!pin) |
| 10813 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10814 | dac = spec->multiout.hp_nid; |
| 10815 | if (!dac) |
| 10816 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10817 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10818 | } |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10819 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10820 | pin = spec->autocfg.speaker_pins[i]; |
| 10821 | if (!pin) |
| 10822 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10823 | dac = spec->multiout.extra_out_nid[0]; |
| 10824 | if (!dac) |
| 10825 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10826 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10827 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10828 | } |
| 10829 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10830 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10831 | { |
| 10832 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10833 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10834 | int i; |
| 10835 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10836 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10837 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10838 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10839 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10840 | snd_hda_codec_write(codec, nid, 0, |
| 10841 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10842 | AMP_OUT_MUTE); |
| 10843 | } |
| 10844 | } |
| 10845 | |
| 10846 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10847 | { |
| 10848 | struct alc_spec *spec = codec->spec; |
| 10849 | int c; |
| 10850 | |
| 10851 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10852 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10853 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10854 | unsigned int mux_idx; |
| 10855 | const struct hda_input_mux *imux; |
| 10856 | int conns, mute, idx, item; |
| 10857 | |
| 10858 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10859 | ARRAY_SIZE(conn_list)); |
| 10860 | if (conns < 0) |
| 10861 | continue; |
| 10862 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10863 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10864 | if (!imux->num_items && mux_idx > 0) |
| 10865 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10866 | for (idx = 0; idx < conns; idx++) { |
| 10867 | /* if the current connection is the selected one, |
| 10868 | * unmute it as default - otherwise mute it |
| 10869 | */ |
| 10870 | mute = AMP_IN_MUTE(idx); |
| 10871 | for (item = 0; item < imux->num_items; item++) { |
| 10872 | if (imux->items[item].index == idx) { |
| 10873 | if (spec->cur_mux[c] == item) |
| 10874 | mute = AMP_IN_UNMUTE(idx); |
| 10875 | break; |
| 10876 | } |
| 10877 | } |
| 10878 | /* check if we have a selector or mixer |
| 10879 | * we could check for the widget type instead, but |
| 10880 | * just check for Amp-In presence (in case of mixer |
| 10881 | * without amp-in there is something wrong, this |
| 10882 | * function shouldn't be used or capsrc nid is wrong) |
| 10883 | */ |
| 10884 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10885 | snd_hda_codec_write(codec, nid, 0, |
| 10886 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10887 | mute); |
| 10888 | else if (mute != AMP_IN_MUTE(idx)) |
| 10889 | snd_hda_codec_write(codec, nid, 0, |
| 10890 | AC_VERB_SET_CONNECT_SEL, |
| 10891 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10892 | } |
| 10893 | } |
| 10894 | } |
| 10895 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10896 | /* add mic boosts if needed */ |
| 10897 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10898 | { |
| 10899 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10900 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10901 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10902 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10903 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10904 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10905 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10906 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10907 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10908 | break; |
| 10909 | nid = cfg->inputs[i].pin; |
| 10910 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10911 | const char *label; |
| 10912 | char boost_label[32]; |
| 10913 | |
| 10914 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 10915 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10916 | type_idx++; |
| 10917 | else |
| 10918 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10919 | prev_label = label; |
| 10920 | |
| 10921 | snprintf(boost_label, sizeof(boost_label), |
| 10922 | "%s Boost Volume", label); |
| 10923 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10924 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10925 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10926 | if (err < 0) |
| 10927 | return err; |
| 10928 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10929 | } |
| 10930 | return 0; |
| 10931 | } |
| 10932 | |
| 10933 | /* almost identical with ALC880 parser... */ |
| 10934 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10935 | { |
| 10936 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10937 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10938 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10939 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10940 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10941 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10942 | if (err < 0) |
| 10943 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10944 | if (!spec->autocfg.line_outs) |
| 10945 | return 0; /* can't find valid BIOS pin config */ |
| 10946 | |
| 10947 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10948 | if (err < 0) |
| 10949 | return err; |
| 10950 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10951 | if (err < 0) |
| 10952 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10953 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10954 | "Headphone"); |
| 10955 | if (err < 0) |
| 10956 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10957 | err = alc880_auto_create_extra_out(spec, |
| 10958 | spec->autocfg.speaker_pins[0], |
| 10959 | "Speaker"); |
| 10960 | if (err < 0) |
| 10961 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10962 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10963 | if (err < 0) |
| 10964 | return err; |
| 10965 | |
| 10966 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10967 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10968 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10969 | |
| 10970 | if (spec->kctls.list) |
| 10971 | add_mixer(spec, spec->kctls.list); |
| 10972 | |
| 10973 | add_verb(spec, alc883_auto_init_verbs); |
| 10974 | /* if ADC 0x07 is available, initialize it, too */ |
| 10975 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10976 | add_verb(spec, alc882_adc1_init_verbs); |
| 10977 | |
| 10978 | spec->num_mux_defs = 1; |
| 10979 | spec->input_mux = &spec->private_imux[0]; |
| 10980 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10981 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10982 | |
| 10983 | err = alc_auto_add_mic_boost(codec); |
| 10984 | if (err < 0) |
| 10985 | return err; |
| 10986 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10987 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10988 | } |
| 10989 | |
| 10990 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10991 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10992 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10993 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10994 | alc882_auto_init_multi_out(codec); |
| 10995 | alc882_auto_init_hp_out(codec); |
| 10996 | alc882_auto_init_analog_input(codec); |
| 10997 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10998 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10999 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11000 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11001 | } |
| 11002 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11003 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11004 | { |
| 11005 | struct alc_spec *spec; |
| 11006 | int err, board_config; |
| 11007 | |
| 11008 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11009 | if (spec == NULL) |
| 11010 | return -ENOMEM; |
| 11011 | |
| 11012 | codec->spec = spec; |
| 11013 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11014 | switch (codec->vendor_id) { |
| 11015 | case 0x10ec0882: |
| 11016 | case 0x10ec0885: |
| 11017 | break; |
| 11018 | default: |
| 11019 | /* ALC883 and variants */ |
| 11020 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11021 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11022 | } |
| 11023 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11024 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 11025 | alc882_models, |
| 11026 | alc882_cfg_tbl); |
| 11027 | |
| 11028 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11029 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11030 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11031 | |
| 11032 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11033 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11034 | codec->chip_name); |
| 11035 | board_config = ALC882_AUTO; |
| 11036 | } |
| 11037 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11038 | if (board_config == ALC882_AUTO) { |
| 11039 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11040 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11041 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11042 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11043 | alc_auto_parse_customize_define(codec); |
| 11044 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11045 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11046 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11047 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11048 | if (err < 0) { |
| 11049 | alc_free(codec); |
| 11050 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11051 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11052 | printk(KERN_INFO |
| 11053 | "hda_codec: Cannot set up configuration " |
| 11054 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11055 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11056 | } |
| 11057 | } |
| 11058 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11059 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11060 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11061 | if (err < 0) { |
| 11062 | alc_free(codec); |
| 11063 | return err; |
| 11064 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11065 | } |
| 11066 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11067 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11068 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11069 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11070 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11071 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11072 | /* FIXME: setup DAC5 */ |
| 11073 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11074 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11075 | |
| 11076 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11077 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11078 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11079 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11080 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11081 | spec->num_adc_nids = 0; |
| 11082 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11083 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11084 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11085 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11086 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11087 | unsigned int wcap = get_wcaps(codec, nid); |
| 11088 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11089 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11090 | if (wcap != AC_WID_AUD_IN) |
| 11091 | continue; |
| 11092 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11093 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11094 | if (err < 0) |
| 11095 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11096 | err = snd_hda_get_connections(codec, cap, items, |
| 11097 | ARRAY_SIZE(items)); |
| 11098 | if (err < 0) |
| 11099 | continue; |
| 11100 | for (j = 0; j < imux->num_items; j++) |
| 11101 | if (imux->items[j].index >= err) |
| 11102 | break; |
| 11103 | if (j < imux->num_items) |
| 11104 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11105 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11106 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11107 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11108 | spec->adc_nids = spec->private_adc_nids; |
| 11109 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11110 | } |
| 11111 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11112 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11113 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11114 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11115 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11116 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11117 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11118 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11119 | spec->vmaster_nid = 0x0c; |
| 11120 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11121 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11122 | if (board_config == ALC882_AUTO) |
| 11123 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11124 | |
| 11125 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11126 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11127 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11128 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11129 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11130 | |
| 11131 | return 0; |
| 11132 | } |
| 11133 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11134 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11135 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11136 | * ALC262 support |
| 11137 | */ |
| 11138 | |
| 11139 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11140 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11141 | |
| 11142 | #define alc262_dac_nids alc260_dac_nids |
| 11143 | #define alc262_adc_nids alc882_adc_nids |
| 11144 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11145 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11146 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11147 | |
| 11148 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11149 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11150 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11151 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11152 | /* ADC0 */ |
| 11153 | 0x09 |
| 11154 | }; |
| 11155 | |
| 11156 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11157 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11158 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11159 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11160 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11161 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11162 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11163 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11164 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11165 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11166 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11167 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11168 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11169 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11170 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11171 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11172 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11173 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11174 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11175 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11176 | }; |
| 11177 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11178 | /* update HP, line and mono-out pins according to the master switch */ |
| 11179 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 11180 | { |
| 11181 | struct alc_spec *spec = codec->spec; |
| 11182 | int val = spec->master_sw; |
| 11183 | |
| 11184 | /* HP & line-out */ |
| 11185 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 11186 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11187 | val ? PIN_HP : 0); |
| 11188 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11189 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11190 | val ? PIN_HP : 0); |
| 11191 | /* mono (speaker) depending on the HP jack sense */ |
| 11192 | val = val && !spec->jack_present; |
| 11193 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11194 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11195 | val ? PIN_OUT : 0); |
| 11196 | } |
| 11197 | |
| 11198 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11199 | { |
| 11200 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11201 | |
| 11202 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11203 | alc262_hp_master_update(codec); |
| 11204 | } |
| 11205 | |
| 11206 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11207 | { |
| 11208 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11209 | return; |
| 11210 | alc262_hp_bpc_automute(codec); |
| 11211 | } |
| 11212 | |
| 11213 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11214 | { |
| 11215 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11216 | |
| 11217 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11218 | alc262_hp_master_update(codec); |
| 11219 | } |
| 11220 | |
| 11221 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11222 | unsigned int res) |
| 11223 | { |
| 11224 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11225 | return; |
| 11226 | alc262_hp_wildwest_automute(codec); |
| 11227 | } |
| 11228 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11229 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11230 | |
| 11231 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11232 | struct snd_ctl_elem_value *ucontrol) |
| 11233 | { |
| 11234 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11235 | struct alc_spec *spec = codec->spec; |
| 11236 | int val = !!*ucontrol->value.integer.value; |
| 11237 | |
| 11238 | if (val == spec->master_sw) |
| 11239 | return 0; |
| 11240 | spec->master_sw = val; |
| 11241 | alc262_hp_master_update(codec); |
| 11242 | return 1; |
| 11243 | } |
| 11244 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11245 | #define ALC262_HP_MASTER_SWITCH \ |
| 11246 | { \ |
| 11247 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11248 | .name = "Master Playback Switch", \ |
| 11249 | .info = snd_ctl_boolean_mono_info, \ |
| 11250 | .get = alc262_hp_master_sw_get, \ |
| 11251 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11252 | }, \ |
| 11253 | { \ |
| 11254 | .iface = NID_MAPPING, \ |
| 11255 | .name = "Master Playback Switch", \ |
| 11256 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11257 | } |
| 11258 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11259 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11260 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11261 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11262 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11263 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11264 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11265 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11266 | HDA_OUTPUT), |
| 11267 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11268 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11269 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11270 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11271 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11272 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11273 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11274 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11275 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11276 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11277 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11278 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11279 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11280 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11281 | { } /* end */ |
| 11282 | }; |
| 11283 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11284 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11285 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11286 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11287 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11288 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11289 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11290 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11291 | HDA_OUTPUT), |
| 11292 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11293 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11294 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11295 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11296 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11297 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11298 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11299 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11300 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11301 | { } /* end */ |
| 11302 | }; |
| 11303 | |
| 11304 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11305 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11306 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11307 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11308 | { } /* end */ |
| 11309 | }; |
| 11310 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11311 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11312 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11313 | { |
| 11314 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11315 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11316 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11317 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11318 | } |
| 11319 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11320 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11321 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11322 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11323 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11324 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11325 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11326 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11327 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11328 | { } /* end */ |
| 11329 | }; |
| 11330 | |
| 11331 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11332 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11333 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11334 | |
| 11335 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11336 | { } |
| 11337 | }; |
| 11338 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11339 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11340 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11341 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11342 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11343 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11344 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11345 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11346 | { } /* end */ |
| 11347 | }; |
| 11348 | |
| 11349 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11350 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11351 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11352 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11353 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11354 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11355 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11356 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11357 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11358 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11359 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11360 | {} |
| 11361 | }; |
| 11362 | |
| 11363 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11364 | .num_items = 1, |
| 11365 | .items = { |
| 11366 | { "Line", 0x1 }, |
| 11367 | }, |
| 11368 | }; |
| 11369 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11370 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11371 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11372 | { |
| 11373 | struct alc_spec *spec = codec->spec; |
| 11374 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11375 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11376 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11377 | unsigned int mute; |
| 11378 | |
| 11379 | /* HP */ |
| 11380 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11381 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11382 | HDA_AMP_MUTE, mute); |
| 11383 | /* mute internal speaker per jack sense */ |
| 11384 | if (spec->jack_present) |
| 11385 | mute = HDA_AMP_MUTE; |
| 11386 | if (line_nid) |
| 11387 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11388 | HDA_AMP_MUTE, mute); |
| 11389 | if (speaker_nid && speaker_nid != line_nid) |
| 11390 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11391 | HDA_AMP_MUTE, mute); |
| 11392 | } |
| 11393 | |
| 11394 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11395 | |
| 11396 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11397 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11398 | { |
| 11399 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11400 | struct alc_spec *spec = codec->spec; |
| 11401 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11402 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11403 | if (val == spec->master_sw) |
| 11404 | return 0; |
| 11405 | spec->master_sw = val; |
| 11406 | alc262_hippo_master_update(codec); |
| 11407 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11408 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11409 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11410 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11411 | { \ |
| 11412 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11413 | .name = "Master Playback Switch", \ |
| 11414 | .info = snd_ctl_boolean_mono_info, \ |
| 11415 | .get = alc262_hippo_master_sw_get, \ |
| 11416 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11417 | }, \ |
| 11418 | { \ |
| 11419 | .iface = NID_MAPPING, \ |
| 11420 | .name = "Master Playback Switch", \ |
| 11421 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11422 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11423 | } |
| 11424 | |
| 11425 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11426 | ALC262_HIPPO_MASTER_SWITCH, |
| 11427 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11428 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11429 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11430 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11431 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11432 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11433 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11434 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11435 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11436 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11437 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11438 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11439 | { } /* end */ |
| 11440 | }; |
| 11441 | |
| 11442 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11443 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11444 | ALC262_HIPPO_MASTER_SWITCH, |
| 11445 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11446 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11447 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11448 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11449 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11450 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11451 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11452 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11453 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11454 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11455 | { } /* end */ |
| 11456 | }; |
| 11457 | |
| 11458 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11459 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11460 | { |
| 11461 | struct alc_spec *spec = codec->spec; |
| 11462 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11463 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11464 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11465 | alc262_hippo_master_update(codec); |
| 11466 | } |
| 11467 | |
| 11468 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11469 | { |
| 11470 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11471 | return; |
| 11472 | alc262_hippo_automute(codec); |
| 11473 | } |
| 11474 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11475 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11476 | { |
| 11477 | struct alc_spec *spec = codec->spec; |
| 11478 | |
| 11479 | spec->autocfg.hp_pins[0] = 0x15; |
| 11480 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11481 | } |
| 11482 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11483 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11484 | { |
| 11485 | struct alc_spec *spec = codec->spec; |
| 11486 | |
| 11487 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11488 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11489 | } |
| 11490 | |
| 11491 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11492 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11493 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11494 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11495 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11496 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11497 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11498 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11499 | { } /* end */ |
| 11500 | }; |
| 11501 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11502 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11503 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11504 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11505 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11508 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11509 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11510 | { } /* end */ |
| 11511 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11512 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11513 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11514 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11515 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11516 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11517 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11518 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11519 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11520 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11521 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11522 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11523 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11524 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11525 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11526 | { } /* end */ |
| 11527 | }; |
| 11528 | |
| 11529 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11530 | /* Headphone automute */ |
| 11531 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11532 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11533 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11534 | |
| 11535 | /* P11 AUX_IN, white 4-pin connector */ |
| 11536 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11537 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11538 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11539 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11540 | |
| 11541 | {} |
| 11542 | }; |
| 11543 | |
| 11544 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11545 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11546 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11547 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11548 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11549 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11550 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11551 | } |
| 11552 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11553 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11554 | #define alc262_capture_mixer alc882_capture_mixer |
| 11555 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11556 | |
| 11557 | /* |
| 11558 | * generic initialization of ADC, input mixers and output mixers |
| 11559 | */ |
| 11560 | static struct hda_verb alc262_init_verbs[] = { |
| 11561 | /* |
| 11562 | * Unmute ADC0-2 and set the default input to mic-in |
| 11563 | */ |
| 11564 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11565 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11566 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11567 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11568 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11569 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11570 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11571 | /* 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] | 11572 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11573 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11574 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11575 | */ |
| 11576 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11577 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11578 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11579 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11580 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11581 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11582 | |
| 11583 | /* |
| 11584 | * Set up output mixers (0x0c - 0x0e) |
| 11585 | */ |
| 11586 | /* set vol=0 to output mixers */ |
| 11587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11588 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11589 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11590 | /* set up input amps for analog loopback */ |
| 11591 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11594 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11595 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11596 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11597 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11598 | |
| 11599 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11600 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11601 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11602 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11603 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11604 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11605 | |
| 11606 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11607 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11608 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11609 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11610 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11611 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11612 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11613 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11614 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11615 | /* FIXME: use matrix-type input source selection */ |
| 11616 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11617 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11618 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11619 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11620 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11621 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11622 | /* Input mixer2 */ |
| 11623 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11624 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11625 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11626 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11627 | /* Input mixer3 */ |
| 11628 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11629 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11630 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11631 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11632 | |
| 11633 | { } |
| 11634 | }; |
| 11635 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11636 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11637 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11638 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11639 | { } |
| 11640 | }; |
| 11641 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11642 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11643 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11644 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11645 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11646 | |
| 11647 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11648 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11649 | {} |
| 11650 | }; |
| 11651 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11652 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11653 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11654 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11655 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11656 | |
| 11657 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11658 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11659 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11660 | }; |
| 11661 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11662 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11663 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11664 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11665 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11666 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11667 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11668 | { } /* end */ |
| 11669 | }; |
| 11670 | |
| 11671 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11672 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11673 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11674 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11675 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11676 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11677 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11678 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11679 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11680 | {} |
| 11681 | }; |
| 11682 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11683 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11684 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11685 | struct alc_spec *spec = codec->spec; |
| 11686 | |
| 11687 | spec->autocfg.hp_pins[0] = 0x15; |
| 11688 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11689 | spec->ext_mic.pin = 0x18; |
| 11690 | spec->ext_mic.mux_idx = 0; |
| 11691 | spec->int_mic.pin = 0x12; |
| 11692 | spec->int_mic.mux_idx = 9; |
| 11693 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11694 | } |
| 11695 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11696 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11697 | * nec model |
| 11698 | * 0x15 = headphone |
| 11699 | * 0x16 = internal speaker |
| 11700 | * 0x18 = external mic |
| 11701 | */ |
| 11702 | |
| 11703 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11704 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11705 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11706 | |
| 11707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11709 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11710 | |
| 11711 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11712 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11713 | { } /* end */ |
| 11714 | }; |
| 11715 | |
| 11716 | static struct hda_verb alc262_nec_verbs[] = { |
| 11717 | /* Unmute Speaker */ |
| 11718 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11719 | |
| 11720 | /* Headphone */ |
| 11721 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11722 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11723 | |
| 11724 | /* External mic to headphone */ |
| 11725 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11726 | /* External mic to speaker */ |
| 11727 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11728 | {} |
| 11729 | }; |
| 11730 | |
| 11731 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11732 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11733 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11734 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11735 | */ |
| 11736 | |
| 11737 | #define ALC_HP_EVENT 0x37 |
| 11738 | |
| 11739 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11740 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11741 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11742 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11743 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11744 | {} |
| 11745 | }; |
| 11746 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11747 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11748 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11749 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11750 | {} |
| 11751 | }; |
| 11752 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11753 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11754 | /* Front Mic pin: input vref at 50% */ |
| 11755 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11756 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11757 | {} |
| 11758 | }; |
| 11759 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11760 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11761 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11762 | .items = { |
| 11763 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11764 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11765 | { "CD", 0x4 }, |
| 11766 | }, |
| 11767 | }; |
| 11768 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11769 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11770 | .num_items = 5, |
| 11771 | .items = { |
| 11772 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11773 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11774 | { "Line", 0x2 }, |
| 11775 | { "CD", 0x4 }, |
| 11776 | { "AUX IN", 0x6 }, |
| 11777 | }, |
| 11778 | }; |
| 11779 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11780 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11781 | .num_items = 4, |
| 11782 | .items = { |
| 11783 | { "Mic", 0x0 }, |
| 11784 | { "Front Mic", 0x2 }, |
| 11785 | { "Line", 0x1 }, |
| 11786 | { "CD", 0x4 }, |
| 11787 | }, |
| 11788 | }; |
| 11789 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11790 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11791 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11792 | { |
| 11793 | struct alc_spec *spec = codec->spec; |
| 11794 | unsigned int mute; |
| 11795 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11796 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11797 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11798 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11799 | spec->sense_updated = 1; |
| 11800 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11801 | /* unmute internal speaker only if both HPs are unplugged and |
| 11802 | * master switch is on |
| 11803 | */ |
| 11804 | if (spec->jack_present) |
| 11805 | mute = HDA_AMP_MUTE; |
| 11806 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11807 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11808 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11809 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11810 | } |
| 11811 | |
| 11812 | /* unsolicited event for HP jack sensing */ |
| 11813 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11814 | unsigned int res) |
| 11815 | { |
| 11816 | if ((res >> 26) != ALC_HP_EVENT) |
| 11817 | return; |
| 11818 | alc262_fujitsu_automute(codec, 1); |
| 11819 | } |
| 11820 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11821 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11822 | { |
| 11823 | alc262_fujitsu_automute(codec, 1); |
| 11824 | } |
| 11825 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11826 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11827 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11828 | .ops = &snd_hda_bind_vol, |
| 11829 | .values = { |
| 11830 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11831 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11832 | 0 |
| 11833 | }, |
| 11834 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11835 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11836 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11837 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11838 | { |
| 11839 | struct alc_spec *spec = codec->spec; |
| 11840 | unsigned int mute; |
| 11841 | |
| 11842 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11843 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11844 | spec->sense_updated = 1; |
| 11845 | } |
| 11846 | if (spec->jack_present) { |
| 11847 | /* mute internal speaker */ |
| 11848 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11849 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11850 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11851 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11852 | } else { |
| 11853 | /* unmute internal speaker if necessary */ |
| 11854 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11855 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11856 | HDA_AMP_MUTE, mute); |
| 11857 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11858 | HDA_AMP_MUTE, mute); |
| 11859 | } |
| 11860 | } |
| 11861 | |
| 11862 | /* unsolicited event for HP jack sensing */ |
| 11863 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11864 | unsigned int res) |
| 11865 | { |
| 11866 | if ((res >> 26) != ALC_HP_EVENT) |
| 11867 | return; |
| 11868 | alc262_lenovo_3000_automute(codec, 1); |
| 11869 | } |
| 11870 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11871 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11872 | int dir, int idx, long *valp) |
| 11873 | { |
| 11874 | int i, change = 0; |
| 11875 | |
| 11876 | for (i = 0; i < 2; i++, valp++) |
| 11877 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11878 | HDA_AMP_MUTE, |
| 11879 | *valp ? 0 : HDA_AMP_MUTE); |
| 11880 | return change; |
| 11881 | } |
| 11882 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11883 | /* bind hp and internal speaker mute (with plug check) */ |
| 11884 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11885 | struct snd_ctl_elem_value *ucontrol) |
| 11886 | { |
| 11887 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11888 | long *valp = ucontrol->value.integer.value; |
| 11889 | int change; |
| 11890 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11891 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11892 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11893 | if (change) |
| 11894 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11895 | return change; |
| 11896 | } |
| 11897 | |
| 11898 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11899 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11900 | { |
| 11901 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11902 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11903 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11904 | .info = snd_hda_mixer_amp_switch_info, |
| 11905 | .get = snd_hda_mixer_amp_switch_get, |
| 11906 | .put = alc262_fujitsu_master_sw_put, |
| 11907 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11908 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11909 | { |
| 11910 | .iface = NID_MAPPING, |
| 11911 | .name = "Master Playback Switch", |
| 11912 | .private_value = 0x1b, |
| 11913 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11914 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11915 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11916 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11917 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11918 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11919 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11920 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11921 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11922 | { } /* end */ |
| 11923 | }; |
| 11924 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11925 | /* bind hp and internal speaker mute (with plug check) */ |
| 11926 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11927 | struct snd_ctl_elem_value *ucontrol) |
| 11928 | { |
| 11929 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11930 | long *valp = ucontrol->value.integer.value; |
| 11931 | int change; |
| 11932 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11933 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11934 | if (change) |
| 11935 | alc262_lenovo_3000_automute(codec, 0); |
| 11936 | return change; |
| 11937 | } |
| 11938 | |
| 11939 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11940 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11941 | { |
| 11942 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11943 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11944 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11945 | .info = snd_hda_mixer_amp_switch_info, |
| 11946 | .get = snd_hda_mixer_amp_switch_get, |
| 11947 | .put = alc262_lenovo_3000_master_sw_put, |
| 11948 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11949 | }, |
| 11950 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11951 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11952 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11953 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11954 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11955 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11956 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11957 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11958 | { } /* end */ |
| 11959 | }; |
| 11960 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11961 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11962 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11963 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11964 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11965 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11966 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11967 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11968 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11969 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11970 | { } /* end */ |
| 11971 | }; |
| 11972 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11973 | /* additional init verbs for Benq laptops */ |
| 11974 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11975 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11976 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11977 | {} |
| 11978 | }; |
| 11979 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11980 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11981 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11982 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11983 | |
| 11984 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11985 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11986 | {} |
| 11987 | }; |
| 11988 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11989 | /* Samsung Q1 Ultra Vista model setup */ |
| 11990 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11991 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11992 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11995 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 11996 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11997 | { } /* end */ |
| 11998 | }; |
| 11999 | |
| 12000 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12001 | /* output mixer */ |
| 12002 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12003 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12004 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12005 | /* speaker */ |
| 12006 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12007 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12008 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12009 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12010 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12011 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12012 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12013 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12014 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12015 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12016 | /* internal mic */ |
| 12017 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12018 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12019 | /* ADC, choose mic */ |
| 12020 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12021 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12022 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12023 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12024 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12025 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12026 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12027 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12028 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 12029 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12030 | {} |
| 12031 | }; |
| 12032 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12033 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12034 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 12035 | { |
| 12036 | struct alc_spec *spec = codec->spec; |
| 12037 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12038 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12039 | mute = 0; |
| 12040 | /* auto-mute only when HP is used as HP */ |
| 12041 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12042 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12043 | if (spec->jack_present) |
| 12044 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12045 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12046 | /* mute/unmute internal speaker */ |
| 12047 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12048 | HDA_AMP_MUTE, mute); |
| 12049 | /* mute/unmute HP */ |
| 12050 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12051 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12052 | } |
| 12053 | |
| 12054 | /* unsolicited event for HP jack sensing */ |
| 12055 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 12056 | unsigned int res) |
| 12057 | { |
| 12058 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12059 | return; |
| 12060 | alc262_ultra_automute(codec); |
| 12061 | } |
| 12062 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12063 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 12064 | .num_items = 2, |
| 12065 | .items = { |
| 12066 | { "Mic", 0x1 }, |
| 12067 | { "Headphone", 0x7 }, |
| 12068 | }, |
| 12069 | }; |
| 12070 | |
| 12071 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12072 | struct snd_ctl_elem_value *ucontrol) |
| 12073 | { |
| 12074 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12075 | struct alc_spec *spec = codec->spec; |
| 12076 | int ret; |
| 12077 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12078 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12079 | if (!ret) |
| 12080 | return 0; |
| 12081 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12082 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12083 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12084 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12085 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12086 | return ret; |
| 12087 | } |
| 12088 | |
| 12089 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12090 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12091 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12092 | { |
| 12093 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12094 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12095 | .info = alc_mux_enum_info, |
| 12096 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12097 | .put = alc262_ultra_mux_enum_put, |
| 12098 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12099 | { |
| 12100 | .iface = NID_MAPPING, |
| 12101 | .name = "Capture Source", |
| 12102 | .private_value = 0x15, |
| 12103 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12104 | { } /* end */ |
| 12105 | }; |
| 12106 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12107 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12108 | * and thus it's bound with a different mixer. |
| 12109 | * This function returns which mixer amp should be used. |
| 12110 | */ |
| 12111 | static int alc262_check_volbit(hda_nid_t nid) |
| 12112 | { |
| 12113 | if (!nid) |
| 12114 | return 0; |
| 12115 | else if (nid == 0x16) |
| 12116 | return 2; |
| 12117 | else |
| 12118 | return 1; |
| 12119 | } |
| 12120 | |
| 12121 | 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] | 12122 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12123 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12124 | unsigned long val; |
| 12125 | int vbit; |
| 12126 | |
| 12127 | vbit = alc262_check_volbit(nid); |
| 12128 | if (!vbit) |
| 12129 | return 0; |
| 12130 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12131 | return 0; |
| 12132 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12133 | if (vbit == 2) |
| 12134 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12135 | else |
| 12136 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12137 | 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] | 12138 | } |
| 12139 | |
| 12140 | 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] | 12141 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12142 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12143 | unsigned long val; |
| 12144 | |
| 12145 | if (!nid) |
| 12146 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12147 | if (nid == 0x16) |
| 12148 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12149 | else |
| 12150 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12151 | 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] | 12152 | } |
| 12153 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12154 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12155 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12156 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12157 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12158 | const char *pfx; |
| 12159 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12160 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12161 | |
| 12162 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12163 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12164 | spec->multiout.dac_nids[0] = 2; |
| 12165 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12166 | pfx = alc_get_line_out_pfx(cfg, true); |
| 12167 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12168 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12169 | for (i = 0; i < 2; i++) { |
| 12170 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12171 | if (err < 0) |
| 12172 | return err; |
| 12173 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12174 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12175 | "Speaker", i); |
| 12176 | if (err < 0) |
| 12177 | return err; |
| 12178 | } |
| 12179 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12180 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12181 | "Headphone", i); |
| 12182 | if (err < 0) |
| 12183 | return err; |
| 12184 | } |
| 12185 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12186 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12187 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12188 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12189 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12190 | if (vbits == 1 || vbits == 2) |
| 12191 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12192 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12193 | for (i = 0; i < 2; i++) { |
| 12194 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12195 | &vbits, i); |
| 12196 | if (err < 0) |
| 12197 | return err; |
| 12198 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12199 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12200 | "Speaker", &vbits, i); |
| 12201 | if (err < 0) |
| 12202 | return err; |
| 12203 | } |
| 12204 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12205 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12206 | "Headphone", &vbits, i); |
| 12207 | if (err < 0) |
| 12208 | return err; |
| 12209 | } |
| 12210 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12211 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12212 | } |
| 12213 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12214 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12215 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12216 | |
| 12217 | /* |
| 12218 | * generic initialization of ADC, input mixers and output mixers |
| 12219 | */ |
| 12220 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12221 | /* |
| 12222 | * Unmute ADC0-2 and set the default input to mic-in |
| 12223 | */ |
| 12224 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12225 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12226 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12227 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12228 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12229 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12230 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12231 | /* 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] | 12232 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12233 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12234 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12235 | */ |
| 12236 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12237 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12238 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12239 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12240 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12241 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12242 | |
| 12243 | /* |
| 12244 | * Set up output mixers (0x0c - 0x0f) |
| 12245 | */ |
| 12246 | /* set vol=0 to output mixers */ |
| 12247 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12248 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12249 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12250 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12251 | /* set up input amps for analog loopback */ |
| 12252 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12253 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12254 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12255 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12256 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12257 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12258 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12259 | |
| 12260 | /* FIXME: use matrix-type input source selection */ |
| 12261 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12262 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12263 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12264 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12265 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12266 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12267 | /* Input mixer2 */ |
| 12268 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12269 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12270 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12271 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12272 | /* Input mixer3 */ |
| 12273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12274 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12275 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12276 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12277 | |
| 12278 | { } |
| 12279 | }; |
| 12280 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12281 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12282 | /* |
| 12283 | * Unmute ADC0-2 and set the default input to mic-in |
| 12284 | */ |
| 12285 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12286 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12287 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12288 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12289 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12290 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12291 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12292 | /* 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] | 12293 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12294 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12295 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12296 | */ |
| 12297 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12298 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12299 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12300 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12301 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12302 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12303 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12304 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12305 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12306 | /* |
| 12307 | * Set up output mixers (0x0c - 0x0e) |
| 12308 | */ |
| 12309 | /* set vol=0 to output mixers */ |
| 12310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12311 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12312 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12313 | |
| 12314 | /* set up input amps for analog loopback */ |
| 12315 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12316 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12317 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12318 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12319 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12320 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12321 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12322 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12323 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12324 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12325 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12326 | |
| 12327 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12328 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12329 | |
| 12330 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12331 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12332 | |
| 12333 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12334 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12335 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12336 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12337 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12338 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12339 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12340 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12341 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12342 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12343 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12344 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12345 | |
| 12346 | |
| 12347 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12348 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12349 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12350 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12351 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12352 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12353 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12354 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12355 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12356 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12357 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12358 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12359 | /* Input mixer2 */ |
| 12360 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12361 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12362 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12364 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12365 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12367 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12368 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12369 | /* Input mixer3 */ |
| 12370 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12373 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12374 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12375 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12376 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12377 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12378 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12379 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12380 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12381 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12382 | { } |
| 12383 | }; |
| 12384 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12385 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12386 | /* |
| 12387 | * Unmute ADC0-2 and set the default input to mic-in |
| 12388 | */ |
| 12389 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12390 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12391 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12392 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12393 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12394 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12395 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12396 | /* 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] | 12397 | * mixer widget |
| 12398 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12399 | * panel mic (mic 2) |
| 12400 | */ |
| 12401 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12402 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12403 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12404 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12405 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12406 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12407 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12408 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12409 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12410 | /* |
| 12411 | * Set up output mixers (0x0c - 0x0e) |
| 12412 | */ |
| 12413 | /* set vol=0 to output mixers */ |
| 12414 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12415 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12416 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12417 | |
| 12418 | /* set up input amps for analog loopback */ |
| 12419 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12420 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12421 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12422 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12423 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12424 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12425 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12426 | |
| 12427 | |
| 12428 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12429 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12430 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12431 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12432 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12433 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12434 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12435 | |
| 12436 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12437 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12438 | |
| 12439 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12440 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12441 | |
| 12442 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12443 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12444 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12445 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12446 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12447 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12448 | |
| 12449 | /* FIXME: use matrix-type input source selection */ |
| 12450 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12451 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12452 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12453 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12454 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12455 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12456 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12457 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12458 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12459 | /* Input mixer2 */ |
| 12460 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12461 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12462 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12463 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12464 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12465 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12466 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12467 | /* Input mixer3 */ |
| 12468 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12470 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12471 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12472 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12473 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12474 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12475 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12476 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12477 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12478 | { } |
| 12479 | }; |
| 12480 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12481 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12482 | |
| 12483 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12484 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12485 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12486 | |
| 12487 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12488 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12489 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12490 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12491 | |
| 12492 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12493 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12494 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12495 | {} |
| 12496 | }; |
| 12497 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12498 | /* |
| 12499 | * Pin config fixes |
| 12500 | */ |
| 12501 | enum { |
| 12502 | PINFIX_FSC_H270, |
| 12503 | }; |
| 12504 | |
| 12505 | static const struct alc_fixup alc262_fixups[] = { |
| 12506 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12507 | .type = ALC_FIXUP_PINS, |
| 12508 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12509 | { 0x14, 0x99130110 }, /* speaker */ |
| 12510 | { 0x15, 0x0221142f }, /* front HP */ |
| 12511 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12512 | { } |
| 12513 | } |
| 12514 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12515 | }; |
| 12516 | |
| 12517 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12518 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12519 | {} |
| 12520 | }; |
| 12521 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12522 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12523 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12524 | #define alc262_loopbacks alc880_loopbacks |
| 12525 | #endif |
| 12526 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12527 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12528 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12529 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12530 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12531 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12532 | |
| 12533 | /* |
| 12534 | * BIOS auto configuration |
| 12535 | */ |
| 12536 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12537 | { |
| 12538 | struct alc_spec *spec = codec->spec; |
| 12539 | int err; |
| 12540 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12541 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12542 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12543 | alc262_ignore); |
| 12544 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12545 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12546 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12547 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12548 | spec->multiout.max_channels = 2; |
| 12549 | spec->no_analog = 1; |
| 12550 | goto dig_only; |
| 12551 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12552 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12553 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12554 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12555 | if (err < 0) |
| 12556 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12557 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12558 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12559 | return err; |
| 12560 | |
| 12561 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12562 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12563 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12564 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12565 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12566 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12567 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12568 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12569 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12570 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12571 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12572 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12573 | err = alc_auto_add_mic_boost(codec); |
| 12574 | if (err < 0) |
| 12575 | return err; |
| 12576 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12577 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12578 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12579 | return 1; |
| 12580 | } |
| 12581 | |
| 12582 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12583 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12584 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12585 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12586 | |
| 12587 | |
| 12588 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12589 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12590 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12591 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12592 | alc262_auto_init_multi_out(codec); |
| 12593 | alc262_auto_init_hp_out(codec); |
| 12594 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12595 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12596 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12597 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12598 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12599 | } |
| 12600 | |
| 12601 | /* |
| 12602 | * configuration and preset |
| 12603 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12604 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12605 | [ALC262_BASIC] = "basic", |
| 12606 | [ALC262_HIPPO] = "hippo", |
| 12607 | [ALC262_HIPPO_1] = "hippo_1", |
| 12608 | [ALC262_FUJITSU] = "fujitsu", |
| 12609 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12610 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12611 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12612 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12613 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12614 | [ALC262_BENQ_T31] = "benq-t31", |
| 12615 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12616 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12617 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12618 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12619 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12620 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12621 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12622 | [ALC262_AUTO] = "auto", |
| 12623 | }; |
| 12624 | |
| 12625 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12626 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12627 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12628 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12629 | ALC262_HP_BPC), |
| 12630 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12631 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12632 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12633 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12634 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12635 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12636 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12637 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12638 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12639 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12640 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12641 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12642 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12643 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12644 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12645 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12646 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12647 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12648 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12649 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12650 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12651 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12652 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12653 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12654 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12655 | #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] | 12656 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12657 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12658 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12659 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12660 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12661 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12662 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12663 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12664 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12665 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12666 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12667 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12668 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12669 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12670 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12671 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12672 | {} |
| 12673 | }; |
| 12674 | |
| 12675 | static struct alc_config_preset alc262_presets[] = { |
| 12676 | [ALC262_BASIC] = { |
| 12677 | .mixers = { alc262_base_mixer }, |
| 12678 | .init_verbs = { alc262_init_verbs }, |
| 12679 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12680 | .dac_nids = alc262_dac_nids, |
| 12681 | .hp_nid = 0x03, |
| 12682 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12683 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12684 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12685 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12686 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12687 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12688 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12689 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12690 | .dac_nids = alc262_dac_nids, |
| 12691 | .hp_nid = 0x03, |
| 12692 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12693 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12694 | .channel_mode = alc262_modes, |
| 12695 | .input_mux = &alc262_capture_source, |
| 12696 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12697 | .setup = alc262_hippo_setup, |
| 12698 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12699 | }, |
| 12700 | [ALC262_HIPPO_1] = { |
| 12701 | .mixers = { alc262_hippo1_mixer }, |
| 12702 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12703 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12704 | .dac_nids = alc262_dac_nids, |
| 12705 | .hp_nid = 0x02, |
| 12706 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12707 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12708 | .channel_mode = alc262_modes, |
| 12709 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12710 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12711 | .setup = alc262_hippo1_setup, |
| 12712 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12713 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12714 | [ALC262_FUJITSU] = { |
| 12715 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12716 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12717 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12718 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12719 | .dac_nids = alc262_dac_nids, |
| 12720 | .hp_nid = 0x03, |
| 12721 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12722 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12723 | .channel_mode = alc262_modes, |
| 12724 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12725 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12726 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12727 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12728 | [ALC262_HP_BPC] = { |
| 12729 | .mixers = { alc262_HP_BPC_mixer }, |
| 12730 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12731 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12732 | .dac_nids = alc262_dac_nids, |
| 12733 | .hp_nid = 0x03, |
| 12734 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12735 | .channel_mode = alc262_modes, |
| 12736 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12737 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12738 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12739 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12740 | [ALC262_HP_BPC_D7000_WF] = { |
| 12741 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12742 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12743 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12744 | .dac_nids = alc262_dac_nids, |
| 12745 | .hp_nid = 0x03, |
| 12746 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12747 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12748 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12749 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12750 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12751 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12752 | [ALC262_HP_BPC_D7000_WL] = { |
| 12753 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12754 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12755 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12756 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12757 | .dac_nids = alc262_dac_nids, |
| 12758 | .hp_nid = 0x03, |
| 12759 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12760 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12761 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12762 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12763 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12764 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12765 | [ALC262_HP_TC_T5735] = { |
| 12766 | .mixers = { alc262_hp_t5735_mixer }, |
| 12767 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12768 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12769 | .dac_nids = alc262_dac_nids, |
| 12770 | .hp_nid = 0x03, |
| 12771 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12772 | .channel_mode = alc262_modes, |
| 12773 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12774 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12775 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12776 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12777 | }, |
| 12778 | [ALC262_HP_RP5700] = { |
| 12779 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12780 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12781 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12782 | .dac_nids = alc262_dac_nids, |
| 12783 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12784 | .channel_mode = alc262_modes, |
| 12785 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12786 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12787 | [ALC262_BENQ_ED8] = { |
| 12788 | .mixers = { alc262_base_mixer }, |
| 12789 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12790 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12791 | .dac_nids = alc262_dac_nids, |
| 12792 | .hp_nid = 0x03, |
| 12793 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12794 | .channel_mode = alc262_modes, |
| 12795 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12796 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12797 | [ALC262_SONY_ASSAMD] = { |
| 12798 | .mixers = { alc262_sony_mixer }, |
| 12799 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12800 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12801 | .dac_nids = alc262_dac_nids, |
| 12802 | .hp_nid = 0x02, |
| 12803 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12804 | .channel_mode = alc262_modes, |
| 12805 | .input_mux = &alc262_capture_source, |
| 12806 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12807 | .setup = alc262_hippo_setup, |
| 12808 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12809 | }, |
| 12810 | [ALC262_BENQ_T31] = { |
| 12811 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12812 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12813 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12814 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12815 | .dac_nids = alc262_dac_nids, |
| 12816 | .hp_nid = 0x03, |
| 12817 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12818 | .channel_mode = alc262_modes, |
| 12819 | .input_mux = &alc262_capture_source, |
| 12820 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12821 | .setup = alc262_hippo_setup, |
| 12822 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12823 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12824 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12825 | .mixers = { alc262_ultra_mixer }, |
| 12826 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12827 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12828 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12829 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12830 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12831 | .channel_mode = alc262_modes, |
| 12832 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12833 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12834 | .capsrc_nids = alc262_capsrc_nids, |
| 12835 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12836 | .unsol_event = alc262_ultra_unsol_event, |
| 12837 | .init_hook = alc262_ultra_automute, |
| 12838 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12839 | [ALC262_LENOVO_3000] = { |
| 12840 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12841 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12842 | alc262_lenovo_3000_unsol_verbs, |
| 12843 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12844 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12845 | .dac_nids = alc262_dac_nids, |
| 12846 | .hp_nid = 0x03, |
| 12847 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12848 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12849 | .channel_mode = alc262_modes, |
| 12850 | .input_mux = &alc262_fujitsu_capture_source, |
| 12851 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12852 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12853 | [ALC262_NEC] = { |
| 12854 | .mixers = { alc262_nec_mixer }, |
| 12855 | .init_verbs = { alc262_nec_verbs }, |
| 12856 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12857 | .dac_nids = alc262_dac_nids, |
| 12858 | .hp_nid = 0x03, |
| 12859 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12860 | .channel_mode = alc262_modes, |
| 12861 | .input_mux = &alc262_capture_source, |
| 12862 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12863 | [ALC262_TOSHIBA_S06] = { |
| 12864 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12865 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12866 | alc262_eapd_verbs }, |
| 12867 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12868 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12869 | .dac_nids = alc262_dac_nids, |
| 12870 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12871 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12872 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12873 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12874 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12875 | .unsol_event = alc_sku_unsol_event, |
| 12876 | .setup = alc262_toshiba_s06_setup, |
| 12877 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12878 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12879 | [ALC262_TOSHIBA_RX1] = { |
| 12880 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12881 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_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 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12889 | .setup = alc262_hippo_setup, |
| 12890 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12891 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12892 | [ALC262_TYAN] = { |
| 12893 | .mixers = { alc262_tyan_mixer }, |
| 12894 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12895 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12896 | .dac_nids = alc262_dac_nids, |
| 12897 | .hp_nid = 0x02, |
| 12898 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12899 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12900 | .channel_mode = alc262_modes, |
| 12901 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12902 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12903 | .setup = alc262_tyan_setup, |
| 12904 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12905 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12906 | }; |
| 12907 | |
| 12908 | static int patch_alc262(struct hda_codec *codec) |
| 12909 | { |
| 12910 | struct alc_spec *spec; |
| 12911 | int board_config; |
| 12912 | int err; |
| 12913 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12914 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12915 | if (spec == NULL) |
| 12916 | return -ENOMEM; |
| 12917 | |
| 12918 | codec->spec = spec; |
| 12919 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12920 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12921 | * under-run |
| 12922 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12923 | { |
| 12924 | int tmp; |
| 12925 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12926 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12927 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12928 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12929 | } |
| 12930 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12931 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12932 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12933 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12934 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12935 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12936 | alc262_models, |
| 12937 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12938 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12939 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12940 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12941 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12942 | board_config = ALC262_AUTO; |
| 12943 | } |
| 12944 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12945 | if (board_config == ALC262_AUTO) { |
| 12946 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12947 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12948 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12949 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12950 | if (board_config == ALC262_AUTO) { |
| 12951 | /* automatic parse from the BIOS config */ |
| 12952 | err = alc262_parse_auto_config(codec); |
| 12953 | if (err < 0) { |
| 12954 | alc_free(codec); |
| 12955 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12956 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12957 | printk(KERN_INFO |
| 12958 | "hda_codec: Cannot set up configuration " |
| 12959 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12960 | board_config = ALC262_BASIC; |
| 12961 | } |
| 12962 | } |
| 12963 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12964 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12965 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12966 | if (err < 0) { |
| 12967 | alc_free(codec); |
| 12968 | return err; |
| 12969 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12970 | } |
| 12971 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12972 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12973 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12974 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12975 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12976 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12977 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12978 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12979 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12980 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12981 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12982 | int i; |
| 12983 | /* check whether the digital-mic has to be supported */ |
| 12984 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12985 | if (spec->input_mux->items[i].index >= 9) |
| 12986 | break; |
| 12987 | } |
| 12988 | if (i < spec->input_mux->num_items) { |
| 12989 | /* use only ADC0 */ |
| 12990 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12991 | spec->num_adc_nids = 1; |
| 12992 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12993 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12994 | /* all analog inputs */ |
| 12995 | /* check whether NID 0x07 is valid */ |
| 12996 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12997 | |
| 12998 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12999 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13000 | if (wcap != AC_WID_AUD_IN) { |
| 13001 | spec->adc_nids = alc262_adc_nids_alt; |
| 13002 | spec->num_adc_nids = |
| 13003 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 13004 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 13005 | } else { |
| 13006 | spec->adc_nids = alc262_adc_nids; |
| 13007 | spec->num_adc_nids = |
| 13008 | ARRAY_SIZE(alc262_adc_nids); |
| 13009 | spec->capsrc_nids = alc262_capsrc_nids; |
| 13010 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13011 | } |
| 13012 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 13013 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13014 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13015 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13016 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13017 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 13018 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 13019 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13020 | spec->vmaster_nid = 0x0c; |
| 13021 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13022 | codec->patch_ops = alc_patch_ops; |
| 13023 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13024 | spec->init_hook = alc262_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13025 | |
| 13026 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13027 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13028 | if (!spec->loopback.amplist) |
| 13029 | spec->loopback.amplist = alc262_loopbacks; |
| 13030 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13031 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13032 | return 0; |
| 13033 | } |
| 13034 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13035 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13036 | * ALC268 channel source setting (2 channel) |
| 13037 | */ |
| 13038 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 13039 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13040 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13041 | static hda_nid_t alc268_dac_nids[2] = { |
| 13042 | /* front, hp */ |
| 13043 | 0x02, 0x03 |
| 13044 | }; |
| 13045 | |
| 13046 | static hda_nid_t alc268_adc_nids[2] = { |
| 13047 | /* ADC0-1 */ |
| 13048 | 0x08, 0x07 |
| 13049 | }; |
| 13050 | |
| 13051 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 13052 | /* ADC0 */ |
| 13053 | 0x08 |
| 13054 | }; |
| 13055 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13056 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 13057 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13058 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 13059 | /* output mixer control */ |
| 13060 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13061 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13062 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13063 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13064 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13065 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13066 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13067 | { } |
| 13068 | }; |
| 13069 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13070 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 13071 | /* output mixer control */ |
| 13072 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13073 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13074 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13075 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13076 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13077 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13078 | { } |
| 13079 | }; |
| 13080 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13081 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13082 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13083 | .ops = &snd_hda_bind_sw, |
| 13084 | .values = { |
| 13085 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13086 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13087 | 0 |
| 13088 | }, |
| 13089 | }; |
| 13090 | |
| 13091 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13092 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13093 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13094 | { } |
| 13095 | }; |
| 13096 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13097 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13098 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13099 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13100 | { } |
| 13101 | }; |
| 13102 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13103 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13104 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13105 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13106 | { } /* end */ |
| 13107 | }; |
| 13108 | |
| 13109 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13110 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13111 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13112 | .ops = &snd_hda_bind_vol, |
| 13113 | .values = { |
| 13114 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13115 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13116 | 0 |
| 13117 | }, |
| 13118 | }; |
| 13119 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13120 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 13121 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 13122 | { |
| 13123 | struct alc_spec *spec = codec->spec; |
| 13124 | unsigned int mute; |
| 13125 | |
| 13126 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13127 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13128 | spec->sense_updated = 1; |
| 13129 | } |
| 13130 | if (spec->jack_present) |
| 13131 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 13132 | else /* unmute internal speaker if necessary */ |
| 13133 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13134 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13135 | HDA_AMP_MUTE, mute); |
| 13136 | } |
| 13137 | |
| 13138 | |
| 13139 | /* bind hp and internal speaker mute (with plug check) */ |
| 13140 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 13141 | struct snd_ctl_elem_value *ucontrol) |
| 13142 | { |
| 13143 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 13144 | long *valp = ucontrol->value.integer.value; |
| 13145 | int change; |
| 13146 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 13147 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13148 | if (change) |
| 13149 | alc268_acer_automute(codec, 0); |
| 13150 | return change; |
| 13151 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13152 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13153 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13154 | /* output mixer control */ |
| 13155 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13156 | { |
| 13157 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13158 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13159 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13160 | .info = snd_hda_mixer_amp_switch_info, |
| 13161 | .get = snd_hda_mixer_amp_switch_get, |
| 13162 | .put = alc268_acer_master_sw_put, |
| 13163 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13164 | }, |
| 13165 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13166 | { } |
| 13167 | }; |
| 13168 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13169 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13170 | /* output mixer control */ |
| 13171 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13172 | { |
| 13173 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13174 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13175 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13176 | .info = snd_hda_mixer_amp_switch_info, |
| 13177 | .get = snd_hda_mixer_amp_switch_get, |
| 13178 | .put = alc268_acer_master_sw_put, |
| 13179 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13180 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13181 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13182 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13183 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13184 | { } |
| 13185 | }; |
| 13186 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13187 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13188 | /* output mixer control */ |
| 13189 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13190 | { |
| 13191 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13192 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13193 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13194 | .info = snd_hda_mixer_amp_switch_info, |
| 13195 | .get = snd_hda_mixer_amp_switch_get, |
| 13196 | .put = alc268_acer_master_sw_put, |
| 13197 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13198 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13199 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13200 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13201 | { } |
| 13202 | }; |
| 13203 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13204 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13205 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13206 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13207 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13208 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13209 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13210 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13211 | { } |
| 13212 | }; |
| 13213 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13214 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13215 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13216 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13218 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13219 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13220 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13221 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13222 | { } |
| 13223 | }; |
| 13224 | |
| 13225 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13226 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13227 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13228 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13229 | |
| 13230 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13231 | unsigned int res) |
| 13232 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13233 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13234 | return; |
| 13235 | alc268_acer_automute(codec, 1); |
| 13236 | } |
| 13237 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13238 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13239 | { |
| 13240 | alc268_acer_automute(codec, 1); |
| 13241 | } |
| 13242 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13243 | /* toggle speaker-output according to the hp-jack state */ |
| 13244 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13245 | { |
| 13246 | unsigned int present; |
| 13247 | unsigned char bits; |
| 13248 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13249 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13250 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13251 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13252 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13253 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13254 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13255 | } |
| 13256 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13257 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13258 | unsigned int res) |
| 13259 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13260 | switch (res >> 26) { |
| 13261 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13262 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13263 | break; |
| 13264 | case ALC880_MIC_EVENT: |
| 13265 | alc_mic_automute(codec); |
| 13266 | break; |
| 13267 | } |
| 13268 | } |
| 13269 | |
| 13270 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13271 | { |
| 13272 | struct alc_spec *spec = codec->spec; |
| 13273 | spec->ext_mic.pin = 0x18; |
| 13274 | spec->ext_mic.mux_idx = 0; |
| 13275 | spec->int_mic.pin = 0x12; |
| 13276 | spec->int_mic.mux_idx = 6; |
| 13277 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13278 | } |
| 13279 | |
| 13280 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13281 | { |
| 13282 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13283 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13284 | } |
| 13285 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13286 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13287 | /* output mixer control */ |
| 13288 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13289 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13290 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13291 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13292 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13293 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13294 | { } |
| 13295 | }; |
| 13296 | |
| 13297 | static struct hda_verb alc268_dell_verbs[] = { |
| 13298 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13299 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13300 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13301 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13302 | { } |
| 13303 | }; |
| 13304 | |
| 13305 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13306 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13307 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13308 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13309 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13310 | spec->autocfg.hp_pins[0] = 0x15; |
| 13311 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13312 | spec->ext_mic.pin = 0x18; |
| 13313 | spec->ext_mic.mux_idx = 0; |
| 13314 | spec->int_mic.pin = 0x19; |
| 13315 | spec->int_mic.mux_idx = 1; |
| 13316 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13317 | } |
| 13318 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13319 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13320 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13321 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13322 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13323 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13324 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13325 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13326 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13327 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13328 | { } |
| 13329 | }; |
| 13330 | |
| 13331 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13332 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13333 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13334 | { } |
| 13335 | }; |
| 13336 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13337 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13338 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13339 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13340 | spec->autocfg.hp_pins[0] = 0x15; |
| 13341 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13342 | spec->ext_mic.pin = 0x18; |
| 13343 | spec->ext_mic.mux_idx = 0; |
| 13344 | spec->int_mic.pin = 0x19; |
| 13345 | spec->int_mic.mux_idx = 1; |
| 13346 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13347 | } |
| 13348 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13349 | /* |
| 13350 | * generic initialization of ADC, input mixers and output mixers |
| 13351 | */ |
| 13352 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13353 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13354 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13355 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13356 | |
| 13357 | /* |
| 13358 | * Set up output mixers (0x0c - 0x0e) |
| 13359 | */ |
| 13360 | /* set vol=0 to output mixers */ |
| 13361 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13362 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13363 | |
| 13364 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13365 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13366 | |
| 13367 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13368 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13369 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13370 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13371 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13372 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13373 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13374 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13375 | |
| 13376 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13377 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13378 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13379 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13380 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13381 | |
| 13382 | /* set PCBEEP vol = 0, mute connections */ |
| 13383 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13384 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13385 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13386 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13387 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13388 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13389 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13390 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13391 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13392 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13393 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13394 | { } |
| 13395 | }; |
| 13396 | |
| 13397 | /* |
| 13398 | * generic initialization of ADC, input mixers and output mixers |
| 13399 | */ |
| 13400 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13401 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13402 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13403 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13404 | |
| 13405 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13406 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13407 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13408 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13409 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13410 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13411 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13412 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13413 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13414 | |
| 13415 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13416 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13417 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13418 | /* set PCBEEP vol = 0, mute connections */ |
| 13419 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13420 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13421 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13422 | |
| 13423 | { } |
| 13424 | }; |
| 13425 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13426 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13427 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13428 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13429 | { } /* end */ |
| 13430 | }; |
| 13431 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13432 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13433 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13434 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13435 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13436 | { } /* end */ |
| 13437 | }; |
| 13438 | |
| 13439 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13440 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13441 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13442 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13443 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13444 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13445 | { } /* end */ |
| 13446 | }; |
| 13447 | |
| 13448 | static struct hda_input_mux alc268_capture_source = { |
| 13449 | .num_items = 4, |
| 13450 | .items = { |
| 13451 | { "Mic", 0x0 }, |
| 13452 | { "Front Mic", 0x1 }, |
| 13453 | { "Line", 0x2 }, |
| 13454 | { "CD", 0x3 }, |
| 13455 | }, |
| 13456 | }; |
| 13457 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13458 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13459 | .num_items = 3, |
| 13460 | .items = { |
| 13461 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13462 | { "Internal Mic", 0x1 }, |
| 13463 | { "Line", 0x2 }, |
| 13464 | }, |
| 13465 | }; |
| 13466 | |
| 13467 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13468 | .num_items = 3, |
| 13469 | .items = { |
| 13470 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13471 | { "Internal Mic", 0x6 }, |
| 13472 | { "Line", 0x2 }, |
| 13473 | }, |
| 13474 | }; |
| 13475 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13476 | #ifdef CONFIG_SND_DEBUG |
| 13477 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13478 | /* Volume widgets */ |
| 13479 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13480 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13481 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13482 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13483 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13484 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13485 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13486 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13487 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13488 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13489 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13490 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13491 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13492 | /* The below appears problematic on some hardwares */ |
| 13493 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13494 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13495 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13496 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13497 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13498 | |
| 13499 | /* Modes for retasking pin widgets */ |
| 13500 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13501 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13502 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13503 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13504 | |
| 13505 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13506 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13507 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13508 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13509 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13510 | |
| 13511 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13512 | * The ALC268 does not have an SPDIF input. |
| 13513 | */ |
| 13514 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13515 | |
| 13516 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13517 | * this output to turn on an external amplifier. |
| 13518 | */ |
| 13519 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13520 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13521 | |
| 13522 | { } /* end */ |
| 13523 | }; |
| 13524 | #endif |
| 13525 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13526 | /* create input playback/capture controls for the given pin */ |
| 13527 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13528 | const char *ctlname, int idx) |
| 13529 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13530 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13531 | int err; |
| 13532 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13533 | switch (nid) { |
| 13534 | case 0x14: |
| 13535 | case 0x16: |
| 13536 | dac = 0x02; |
| 13537 | break; |
| 13538 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13539 | case 0x1a: /* ALC259/269 only */ |
| 13540 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13541 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13542 | dac = 0x03; |
| 13543 | break; |
| 13544 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13545 | snd_printd(KERN_WARNING "hda_codec: " |
| 13546 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13547 | return 0; |
| 13548 | } |
| 13549 | if (spec->multiout.dac_nids[0] != dac && |
| 13550 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13551 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13552 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13553 | HDA_OUTPUT)); |
| 13554 | if (err < 0) |
| 13555 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13556 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13557 | } |
| 13558 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13559 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13560 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13561 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13562 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13563 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13564 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13565 | if (err < 0) |
| 13566 | return err; |
| 13567 | return 0; |
| 13568 | } |
| 13569 | |
| 13570 | /* add playback controls from the parsed DAC table */ |
| 13571 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13572 | const struct auto_pin_cfg *cfg) |
| 13573 | { |
| 13574 | hda_nid_t nid; |
| 13575 | int err; |
| 13576 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13577 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13578 | |
| 13579 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13580 | if (nid) { |
| 13581 | const char *name; |
| 13582 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13583 | name = "Speaker"; |
| 13584 | else |
| 13585 | name = "Front"; |
| 13586 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13587 | if (err < 0) |
| 13588 | return err; |
| 13589 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13590 | |
| 13591 | nid = cfg->speaker_pins[0]; |
| 13592 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13593 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13594 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13595 | if (err < 0) |
| 13596 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13597 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13598 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13599 | if (err < 0) |
| 13600 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13601 | } |
| 13602 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13603 | if (nid) { |
| 13604 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13605 | if (err < 0) |
| 13606 | return err; |
| 13607 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13608 | |
| 13609 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13610 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13611 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13612 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13613 | if (err < 0) |
| 13614 | return err; |
| 13615 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13616 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13617 | } |
| 13618 | |
| 13619 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13620 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13621 | const struct auto_pin_cfg *cfg) |
| 13622 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13623 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13624 | } |
| 13625 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13626 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13627 | hda_nid_t nid, int pin_type) |
| 13628 | { |
| 13629 | int idx; |
| 13630 | |
| 13631 | alc_set_pin_output(codec, nid, pin_type); |
| 13632 | if (nid == 0x14 || nid == 0x16) |
| 13633 | idx = 0; |
| 13634 | else |
| 13635 | idx = 1; |
| 13636 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13637 | } |
| 13638 | |
| 13639 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13640 | { |
| 13641 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13642 | int i; |
| 13643 | |
| 13644 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13645 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13646 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13647 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13648 | } |
| 13649 | } |
| 13650 | |
| 13651 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13652 | { |
| 13653 | struct alc_spec *spec = codec->spec; |
| 13654 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13655 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13656 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13657 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13658 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13659 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13660 | } |
| 13661 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13662 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13663 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13664 | } |
| 13665 | if (spec->autocfg.mono_out_pin) |
| 13666 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13667 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13668 | } |
| 13669 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13670 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13671 | { |
| 13672 | struct alc_spec *spec = codec->spec; |
| 13673 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13674 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13675 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13676 | unsigned int dac_vol1, dac_vol2; |
| 13677 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13678 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13679 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13680 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13681 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13682 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13683 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13684 | AMP_IN_UNMUTE(1)); |
| 13685 | snd_hda_codec_write(codec, 0x10, 0, |
| 13686 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13687 | AMP_IN_UNMUTE(1)); |
| 13688 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13689 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13690 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13691 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13692 | snd_hda_codec_write(codec, 0x10, 0, |
| 13693 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13694 | } |
| 13695 | |
| 13696 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13697 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13698 | dac_vol2 = AMP_OUT_ZERO; |
| 13699 | else if (line_nid == 0x15) |
| 13700 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13701 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13702 | dac_vol2 = AMP_OUT_ZERO; |
| 13703 | else if (hp_nid == 0x15) |
| 13704 | dac_vol1 = AMP_OUT_ZERO; |
| 13705 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13706 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13707 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13708 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13709 | |
| 13710 | snd_hda_codec_write(codec, 0x02, 0, |
| 13711 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13712 | snd_hda_codec_write(codec, 0x03, 0, |
| 13713 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13714 | } |
| 13715 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13716 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13717 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13718 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13719 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13720 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13721 | |
| 13722 | /* |
| 13723 | * BIOS auto configuration |
| 13724 | */ |
| 13725 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13726 | { |
| 13727 | struct alc_spec *spec = codec->spec; |
| 13728 | int err; |
| 13729 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13730 | |
| 13731 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13732 | alc268_ignore); |
| 13733 | if (err < 0) |
| 13734 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13735 | if (!spec->autocfg.line_outs) { |
| 13736 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13737 | spec->multiout.max_channels = 2; |
| 13738 | spec->no_analog = 1; |
| 13739 | goto dig_only; |
| 13740 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13741 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13742 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13743 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13744 | if (err < 0) |
| 13745 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13746 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13747 | if (err < 0) |
| 13748 | return err; |
| 13749 | |
| 13750 | spec->multiout.max_channels = 2; |
| 13751 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13752 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13753 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13754 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13755 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13756 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13757 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13758 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13759 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13760 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13761 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13762 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13763 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13764 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13765 | err = alc_auto_add_mic_boost(codec); |
| 13766 | if (err < 0) |
| 13767 | return err; |
| 13768 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13769 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13770 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13771 | return 1; |
| 13772 | } |
| 13773 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13774 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13775 | |
| 13776 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13777 | static void alc268_auto_init(struct hda_codec *codec) |
| 13778 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13779 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13780 | alc268_auto_init_multi_out(codec); |
| 13781 | alc268_auto_init_hp_out(codec); |
| 13782 | alc268_auto_init_mono_speaker_out(codec); |
| 13783 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13784 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13785 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13786 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13787 | } |
| 13788 | |
| 13789 | /* |
| 13790 | * configuration and preset |
| 13791 | */ |
| 13792 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13793 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13794 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13795 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13796 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13797 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13798 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13799 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13800 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13801 | #ifdef CONFIG_SND_DEBUG |
| 13802 | [ALC268_TEST] = "test", |
| 13803 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13804 | [ALC268_AUTO] = "auto", |
| 13805 | }; |
| 13806 | |
| 13807 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13808 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13809 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13810 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13811 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13812 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13813 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13814 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13815 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13816 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13817 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13818 | /* almost compatible with toshiba but with optional digital outs; |
| 13819 | * auto-probing seems working fine |
| 13820 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13821 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13822 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13823 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13824 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13825 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13826 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13827 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13828 | {} |
| 13829 | }; |
| 13830 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13831 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13832 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13833 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13834 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13835 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13836 | ALC268_TOSHIBA), |
| 13837 | {} |
| 13838 | }; |
| 13839 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13840 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13841 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13842 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13843 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13844 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13845 | alc267_quanta_il1_verbs }, |
| 13846 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13847 | .dac_nids = alc268_dac_nids, |
| 13848 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13849 | .adc_nids = alc268_adc_nids_alt, |
| 13850 | .hp_nid = 0x03, |
| 13851 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13852 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13853 | .unsol_event = alc_sku_unsol_event, |
| 13854 | .setup = alc267_quanta_il1_setup, |
| 13855 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13856 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13857 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13858 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13859 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13860 | .init_verbs = { alc268_base_init_verbs }, |
| 13861 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13862 | .dac_nids = alc268_dac_nids, |
| 13863 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13864 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13865 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13866 | .hp_nid = 0x03, |
| 13867 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13868 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13869 | .channel_mode = alc268_modes, |
| 13870 | .input_mux = &alc268_capture_source, |
| 13871 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13872 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13873 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13874 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13875 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13876 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13877 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13878 | .dac_nids = alc268_dac_nids, |
| 13879 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13880 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13881 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13882 | .hp_nid = 0x03, |
| 13883 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13884 | .channel_mode = alc268_modes, |
| 13885 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13886 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13887 | .setup = alc268_toshiba_setup, |
| 13888 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13889 | }, |
| 13890 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13891 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13892 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13893 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13894 | alc268_acer_verbs }, |
| 13895 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13896 | .dac_nids = alc268_dac_nids, |
| 13897 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13898 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13899 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13900 | .hp_nid = 0x02, |
| 13901 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13902 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13903 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13904 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13905 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13906 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13907 | [ALC268_ACER_DMIC] = { |
| 13908 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13909 | alc268_beep_mixer }, |
| 13910 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13911 | alc268_acer_verbs }, |
| 13912 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13913 | .dac_nids = alc268_dac_nids, |
| 13914 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13915 | .adc_nids = alc268_adc_nids_alt, |
| 13916 | .capsrc_nids = alc268_capsrc_nids, |
| 13917 | .hp_nid = 0x02, |
| 13918 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13919 | .channel_mode = alc268_modes, |
| 13920 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13921 | .unsol_event = alc268_acer_unsol_event, |
| 13922 | .init_hook = alc268_acer_init_hook, |
| 13923 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13924 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13925 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13926 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13927 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13928 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13929 | alc268_acer_aspire_one_verbs }, |
| 13930 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13931 | .dac_nids = alc268_dac_nids, |
| 13932 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13933 | .adc_nids = alc268_adc_nids_alt, |
| 13934 | .capsrc_nids = alc268_capsrc_nids, |
| 13935 | .hp_nid = 0x03, |
| 13936 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13937 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13938 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13939 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13940 | .init_hook = alc268_acer_lc_init_hook, |
| 13941 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13942 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13943 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13944 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13945 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13946 | alc268_dell_verbs }, |
| 13947 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13948 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13949 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13950 | .adc_nids = alc268_adc_nids_alt, |
| 13951 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13952 | .hp_nid = 0x02, |
| 13953 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13954 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13955 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13956 | .setup = alc268_dell_setup, |
| 13957 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13958 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13959 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13960 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13961 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13962 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13963 | alc268_toshiba_verbs }, |
| 13964 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13965 | .dac_nids = alc268_dac_nids, |
| 13966 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13967 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13968 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13969 | .hp_nid = 0x03, |
| 13970 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13971 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13972 | .channel_mode = alc268_modes, |
| 13973 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13974 | .setup = alc268_toshiba_setup, |
| 13975 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13976 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13977 | #ifdef CONFIG_SND_DEBUG |
| 13978 | [ALC268_TEST] = { |
| 13979 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13980 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13981 | alc268_volume_init_verbs }, |
| 13982 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13983 | .dac_nids = alc268_dac_nids, |
| 13984 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13985 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13986 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13987 | .hp_nid = 0x03, |
| 13988 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13989 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13990 | .channel_mode = alc268_modes, |
| 13991 | .input_mux = &alc268_capture_source, |
| 13992 | }, |
| 13993 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13994 | }; |
| 13995 | |
| 13996 | static int patch_alc268(struct hda_codec *codec) |
| 13997 | { |
| 13998 | struct alc_spec *spec; |
| 13999 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14000 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14001 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 14002 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14003 | if (spec == NULL) |
| 14004 | return -ENOMEM; |
| 14005 | |
| 14006 | codec->spec = spec; |
| 14007 | |
| 14008 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 14009 | alc268_models, |
| 14010 | alc268_cfg_tbl); |
| 14011 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14012 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 14013 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 14014 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14015 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14016 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14017 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14018 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14019 | board_config = ALC268_AUTO; |
| 14020 | } |
| 14021 | |
| 14022 | if (board_config == ALC268_AUTO) { |
| 14023 | /* automatic parse from the BIOS config */ |
| 14024 | err = alc268_parse_auto_config(codec); |
| 14025 | if (err < 0) { |
| 14026 | alc_free(codec); |
| 14027 | return err; |
| 14028 | } else if (!err) { |
| 14029 | printk(KERN_INFO |
| 14030 | "hda_codec: Cannot set up configuration " |
| 14031 | "from BIOS. Using base mode...\n"); |
| 14032 | board_config = ALC268_3ST; |
| 14033 | } |
| 14034 | } |
| 14035 | |
| 14036 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14037 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14038 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14039 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 14040 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 14041 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14042 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14043 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 14044 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14045 | has_beep = 0; |
| 14046 | for (i = 0; i < spec->num_mixers; i++) { |
| 14047 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 14048 | has_beep = 1; |
| 14049 | break; |
| 14050 | } |
| 14051 | } |
| 14052 | |
| 14053 | if (has_beep) { |
| 14054 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14055 | if (err < 0) { |
| 14056 | alc_free(codec); |
| 14057 | return err; |
| 14058 | } |
| 14059 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14060 | /* override the amp caps for beep generator */ |
| 14061 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14062 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14063 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14064 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14065 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14066 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14067 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14068 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14069 | /* check whether NID 0x07 is valid */ |
| 14070 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14071 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14072 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14073 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14074 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14075 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14076 | if (spec->auto_mic || |
| 14077 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14078 | spec->adc_nids = alc268_adc_nids_alt; |
| 14079 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14080 | if (spec->auto_mic) |
| 14081 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14082 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14083 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14084 | else |
| 14085 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14086 | } else { |
| 14087 | spec->adc_nids = alc268_adc_nids; |
| 14088 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14089 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14090 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14091 | /* set default input source */ |
| 14092 | for (i = 0; i < spec->num_adc_nids; i++) |
| 14093 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 14094 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 14095 | i < spec->num_mux_defs ? |
| 14096 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14097 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14098 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14099 | |
| 14100 | spec->vmaster_nid = 0x02; |
| 14101 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14102 | codec->patch_ops = alc_patch_ops; |
| 14103 | if (board_config == ALC268_AUTO) |
| 14104 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14105 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14106 | alc_init_jacks(codec); |
| 14107 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14108 | return 0; |
| 14109 | } |
| 14110 | |
| 14111 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14112 | * ALC269 channel source setting (2 channel) |
| 14113 | */ |
| 14114 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14115 | |
| 14116 | #define alc269_dac_nids alc260_dac_nids |
| 14117 | |
| 14118 | static hda_nid_t alc269_adc_nids[1] = { |
| 14119 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14120 | 0x08, |
| 14121 | }; |
| 14122 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14123 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14124 | 0x23, |
| 14125 | }; |
| 14126 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14127 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14128 | /* ADC1 */ |
| 14129 | 0x09, |
| 14130 | }; |
| 14131 | |
| 14132 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14133 | 0x22, |
| 14134 | }; |
| 14135 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14136 | static hda_nid_t alc269_adc_candidates[] = { |
| 14137 | 0x08, 0x09, 0x07, |
| 14138 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14139 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14140 | #define alc269_modes alc260_modes |
| 14141 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14142 | |
| 14143 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14144 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14145 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14146 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14147 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14148 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14149 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14150 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14151 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14152 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14153 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14154 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14155 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14156 | { } /* end */ |
| 14157 | }; |
| 14158 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14159 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14160 | /* output mixer control */ |
| 14161 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14162 | { |
| 14163 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14164 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14165 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14166 | .info = snd_hda_mixer_amp_switch_info, |
| 14167 | .get = snd_hda_mixer_amp_switch_get, |
| 14168 | .put = alc268_acer_master_sw_put, |
| 14169 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14170 | }, |
| 14171 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14172 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14173 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14174 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14175 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14176 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14177 | { } |
| 14178 | }; |
| 14179 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14180 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14181 | /* output mixer control */ |
| 14182 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14183 | { |
| 14184 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14185 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14186 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14187 | .info = snd_hda_mixer_amp_switch_info, |
| 14188 | .get = snd_hda_mixer_amp_switch_get, |
| 14189 | .put = alc268_acer_master_sw_put, |
| 14190 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14191 | }, |
| 14192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14194 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14195 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14196 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14197 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14198 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14199 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14200 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14201 | { } |
| 14202 | }; |
| 14203 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14204 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14205 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14206 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14207 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14208 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14209 | { } /* end */ |
| 14210 | }; |
| 14211 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14212 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14213 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14214 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14215 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14216 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14217 | { } /* end */ |
| 14218 | }; |
| 14219 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14220 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14221 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14222 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14223 | { } /* end */ |
| 14224 | }; |
| 14225 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14226 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14227 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14228 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14229 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14230 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14231 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14232 | { } /* end */ |
| 14233 | }; |
| 14234 | |
| 14235 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14236 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14237 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14238 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14239 | { } /* end */ |
| 14240 | }; |
| 14241 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14242 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14243 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14244 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14245 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14246 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14247 | { } /* end */ |
| 14248 | }; |
| 14249 | |
| 14250 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14251 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14252 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14253 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14254 | { } /* end */ |
| 14255 | }; |
| 14256 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14257 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14258 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14259 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14260 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14261 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14262 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14263 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14264 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14265 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14266 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14267 | { } |
| 14268 | }; |
| 14269 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14270 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14271 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14272 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14273 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14274 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14275 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14276 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14277 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14278 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14279 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14280 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14281 | { } |
| 14282 | }; |
| 14283 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14284 | /* toggle speaker-output according to the hp-jack state */ |
| 14285 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14286 | { |
| 14287 | unsigned int present; |
| 14288 | unsigned char bits; |
| 14289 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14290 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14291 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14292 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14293 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14294 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14295 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14296 | |
| 14297 | snd_hda_codec_write(codec, 0x20, 0, |
| 14298 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14299 | snd_hda_codec_write(codec, 0x20, 0, |
| 14300 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14301 | |
| 14302 | snd_hda_codec_write(codec, 0x20, 0, |
| 14303 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14304 | snd_hda_codec_write(codec, 0x20, 0, |
| 14305 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14306 | } |
| 14307 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14308 | /* toggle speaker-output according to the hp-jacks state */ |
| 14309 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14310 | { |
| 14311 | unsigned int present; |
| 14312 | unsigned char bits; |
| 14313 | |
| 14314 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14315 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14316 | |
| 14317 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14318 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14319 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14320 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14321 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14322 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14323 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14324 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14325 | |
| 14326 | snd_hda_codec_write(codec, 0x20, 0, |
| 14327 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14328 | snd_hda_codec_write(codec, 0x20, 0, |
| 14329 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14330 | |
| 14331 | snd_hda_codec_write(codec, 0x20, 0, |
| 14332 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14333 | snd_hda_codec_write(codec, 0x20, 0, |
| 14334 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14335 | } |
| 14336 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14337 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14338 | { |
| 14339 | unsigned int present_laptop; |
| 14340 | unsigned int present_dock; |
| 14341 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14342 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14343 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14344 | |
| 14345 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14346 | if (present_dock) |
| 14347 | snd_hda_codec_write(codec, 0x23, 0, |
| 14348 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14349 | if (present_laptop) |
| 14350 | snd_hda_codec_write(codec, 0x23, 0, |
| 14351 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14352 | if (!present_dock && !present_laptop) |
| 14353 | snd_hda_codec_write(codec, 0x23, 0, |
| 14354 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14355 | } |
| 14356 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14357 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14358 | unsigned int res) |
| 14359 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14360 | switch (res >> 26) { |
| 14361 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14362 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14363 | break; |
| 14364 | case ALC880_MIC_EVENT: |
| 14365 | alc_mic_automute(codec); |
| 14366 | break; |
| 14367 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14368 | } |
| 14369 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14370 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14371 | unsigned int res) |
| 14372 | { |
| 14373 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14374 | alc269_lifebook_speaker_automute(codec); |
| 14375 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14376 | alc269_lifebook_mic_autoswitch(codec); |
| 14377 | } |
| 14378 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14379 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14380 | { |
| 14381 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14382 | spec->autocfg.hp_pins[0] = 0x15; |
| 14383 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14384 | spec->ext_mic.pin = 0x18; |
| 14385 | spec->ext_mic.mux_idx = 0; |
| 14386 | spec->int_mic.pin = 0x19; |
| 14387 | spec->int_mic.mux_idx = 1; |
| 14388 | spec->auto_mic = 1; |
| 14389 | } |
| 14390 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14391 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14392 | { |
| 14393 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14394 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14395 | } |
| 14396 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14397 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14398 | { |
| 14399 | alc269_lifebook_speaker_automute(codec); |
| 14400 | alc269_lifebook_mic_autoswitch(codec); |
| 14401 | } |
| 14402 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14403 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14404 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14405 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14406 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14407 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14408 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14409 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14410 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14411 | {} |
| 14412 | }; |
| 14413 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14414 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14415 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14416 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14417 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14419 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14420 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14421 | {} |
| 14422 | }; |
| 14423 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14424 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14425 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14426 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14427 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14428 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14429 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14430 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14431 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14432 | {} |
| 14433 | }; |
| 14434 | |
| 14435 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14436 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14437 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14438 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14439 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14440 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14441 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14442 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14443 | {} |
| 14444 | }; |
| 14445 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14446 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14447 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14448 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14449 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14450 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14451 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14452 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14453 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14454 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14455 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14456 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14457 | { } |
| 14458 | }; |
| 14459 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14460 | /* toggle speaker-output according to the hp-jack state */ |
| 14461 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14462 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14463 | struct alc_spec *spec = codec->spec; |
| 14464 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14465 | unsigned int present; |
| 14466 | unsigned char bits; |
| 14467 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14468 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14469 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14470 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14471 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14472 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14473 | HDA_AMP_MUTE, bits); |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14474 | alc_report_jack(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14475 | } |
| 14476 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14477 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14478 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14479 | unsigned int res) |
| 14480 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14481 | switch (res >> 26) { |
| 14482 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14483 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14484 | break; |
| 14485 | case ALC880_MIC_EVENT: |
| 14486 | alc_mic_automute(codec); |
| 14487 | break; |
| 14488 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14489 | } |
| 14490 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14491 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14492 | { |
| 14493 | struct alc_spec *spec = codec->spec; |
| 14494 | spec->autocfg.hp_pins[0] = 0x15; |
| 14495 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14496 | spec->ext_mic.pin = 0x18; |
| 14497 | spec->ext_mic.mux_idx = 0; |
| 14498 | spec->int_mic.pin = 0x19; |
| 14499 | spec->int_mic.mux_idx = 1; |
| 14500 | spec->auto_mic = 1; |
| 14501 | } |
| 14502 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14503 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14504 | { |
| 14505 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14506 | spec->autocfg.hp_pins[0] = 0x15; |
| 14507 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14508 | spec->ext_mic.pin = 0x18; |
| 14509 | spec->ext_mic.mux_idx = 0; |
| 14510 | spec->int_mic.pin = 0x12; |
| 14511 | spec->int_mic.mux_idx = 5; |
| 14512 | spec->auto_mic = 1; |
| 14513 | } |
| 14514 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14515 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14516 | { |
| 14517 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14518 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14519 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14520 | spec->ext_mic.pin = 0x18; |
| 14521 | spec->ext_mic.mux_idx = 0; |
| 14522 | spec->int_mic.pin = 0x19; |
| 14523 | spec->int_mic.mux_idx = 1; |
| 14524 | spec->auto_mic = 1; |
| 14525 | } |
| 14526 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14527 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14528 | { |
| 14529 | struct alc_spec *spec = codec->spec; |
| 14530 | spec->autocfg.hp_pins[0] = 0x21; |
| 14531 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14532 | spec->ext_mic.pin = 0x18; |
| 14533 | spec->ext_mic.mux_idx = 0; |
| 14534 | spec->int_mic.pin = 0x12; |
| 14535 | spec->int_mic.mux_idx = 6; |
| 14536 | spec->auto_mic = 1; |
| 14537 | } |
| 14538 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14539 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14540 | { |
| 14541 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14542 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14543 | } |
| 14544 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14545 | /* |
| 14546 | * generic initialization of ADC, input mixers and output mixers |
| 14547 | */ |
| 14548 | static struct hda_verb alc269_init_verbs[] = { |
| 14549 | /* |
| 14550 | * Unmute ADC0 and set the default input to mic-in |
| 14551 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14552 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14553 | |
| 14554 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14555 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14556 | */ |
| 14557 | /* set vol=0 to output mixers */ |
| 14558 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14559 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14560 | |
| 14561 | /* set up input amps for analog loopback */ |
| 14562 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14563 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14564 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14565 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14566 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14567 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14568 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14569 | |
| 14570 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14571 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14572 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14573 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14574 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14575 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14576 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14577 | |
| 14578 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14579 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14580 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14581 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14582 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14583 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14584 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14585 | |
| 14586 | /* set EAPD */ |
| 14587 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14588 | { } |
| 14589 | }; |
| 14590 | |
| 14591 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14592 | /* |
| 14593 | * Unmute ADC0 and set the default input to mic-in |
| 14594 | */ |
| 14595 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14596 | |
| 14597 | /* |
| 14598 | * Set up output mixers (0x02 - 0x03) |
| 14599 | */ |
| 14600 | /* set vol=0 to output mixers */ |
| 14601 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14602 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14603 | |
| 14604 | /* set up input amps for analog loopback */ |
| 14605 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14606 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14607 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14608 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14609 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14610 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14611 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14612 | |
| 14613 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14614 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14615 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14616 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14617 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14618 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14619 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14620 | |
| 14621 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14622 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14623 | |
| 14624 | /* FIXME: use Mux-type input source selection */ |
| 14625 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14626 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14627 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14628 | |
| 14629 | /* set EAPD */ |
| 14630 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14631 | { } |
| 14632 | }; |
| 14633 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14634 | #define alc269_auto_create_multi_out_ctls \ |
| 14635 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14636 | #define alc269_auto_create_input_ctls \ |
| 14637 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14638 | |
| 14639 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14640 | #define alc269_loopbacks alc880_loopbacks |
| 14641 | #endif |
| 14642 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14643 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14644 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14645 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14646 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14647 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14648 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14649 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14650 | .substreams = 1, |
| 14651 | .channels_min = 2, |
| 14652 | .channels_max = 8, |
| 14653 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14654 | /* NID is set in alc_build_pcms */ |
| 14655 | .ops = { |
| 14656 | .open = alc880_playback_pcm_open, |
| 14657 | .prepare = alc880_playback_pcm_prepare, |
| 14658 | .cleanup = alc880_playback_pcm_cleanup |
| 14659 | }, |
| 14660 | }; |
| 14661 | |
| 14662 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14663 | .substreams = 1, |
| 14664 | .channels_min = 2, |
| 14665 | .channels_max = 2, |
| 14666 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14667 | /* NID is set in alc_build_pcms */ |
| 14668 | }; |
| 14669 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14670 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14671 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14672 | { |
| 14673 | switch (codec->subsystem_id) { |
| 14674 | case 0x103c1586: |
| 14675 | return 1; |
| 14676 | } |
| 14677 | return 0; |
| 14678 | } |
| 14679 | |
| 14680 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14681 | { |
| 14682 | /* update mute-LED according to the speaker mute state */ |
| 14683 | if (nid == 0x01 || nid == 0x14) { |
| 14684 | int pinval; |
| 14685 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14686 | HDA_AMP_MUTE) |
| 14687 | pinval = 0x24; |
| 14688 | else |
| 14689 | pinval = 0x20; |
| 14690 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a5 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14691 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14692 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14693 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14694 | } |
| 14695 | return alc_check_power_status(codec, nid); |
| 14696 | } |
| 14697 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14698 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14699 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14700 | { |
| 14701 | struct alc_spec *spec = codec->spec; |
| 14702 | |
| 14703 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14704 | return 0; |
| 14705 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14706 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14707 | if (spec->ext_mic.pin <= 0x12) { |
| 14708 | spec->private_adc_nids[0] = 0x08; |
| 14709 | spec->private_adc_nids[1] = 0x11; |
| 14710 | spec->private_capsrc_nids[0] = 0x23; |
| 14711 | spec->private_capsrc_nids[1] = 0x22; |
| 14712 | } else { |
| 14713 | spec->private_adc_nids[0] = 0x11; |
| 14714 | spec->private_adc_nids[1] = 0x08; |
| 14715 | spec->private_capsrc_nids[0] = 0x22; |
| 14716 | spec->private_capsrc_nids[1] = 0x23; |
| 14717 | } |
| 14718 | spec->adc_nids = spec->private_adc_nids; |
| 14719 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14720 | spec->num_adc_nids = 2; |
| 14721 | spec->dual_adc_switch = 1; |
| 14722 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14723 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14724 | return 1; |
| 14725 | } |
| 14726 | return 0; |
| 14727 | } |
| 14728 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14729 | /* different alc269-variants */ |
| 14730 | enum { |
| 14731 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14732 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14733 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14734 | ALC269_TYPE_ALC269VB, |
| 14735 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14736 | ALC269_TYPE_ALC271X, |
| 14737 | }; |
| 14738 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14739 | /* |
| 14740 | * BIOS auto configuration |
| 14741 | */ |
| 14742 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14743 | { |
| 14744 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14745 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14746 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14747 | |
| 14748 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14749 | alc269_ignore); |
| 14750 | if (err < 0) |
| 14751 | return err; |
| 14752 | |
| 14753 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14754 | if (err < 0) |
| 14755 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14756 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14757 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14758 | else |
| 14759 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14760 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14761 | if (err < 0) |
| 14762 | return err; |
| 14763 | |
| 14764 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14765 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14766 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14767 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14768 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14769 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14770 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14771 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14772 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14773 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14774 | } else { |
| 14775 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14776 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14777 | } |
| 14778 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14779 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14780 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14781 | |
| 14782 | if (!alc275_setup_dual_adc(codec)) |
| 14783 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14784 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14785 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14786 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14787 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14788 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14789 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14790 | |
| 14791 | err = alc_auto_add_mic_boost(codec); |
| 14792 | if (err < 0) |
| 14793 | return err; |
| 14794 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14795 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14796 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14797 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14798 | return 1; |
| 14799 | } |
| 14800 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14801 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14802 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14803 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14804 | |
| 14805 | |
| 14806 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14807 | static void alc269_auto_init(struct hda_codec *codec) |
| 14808 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14809 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14810 | alc269_auto_init_multi_out(codec); |
| 14811 | alc269_auto_init_hp_out(codec); |
| 14812 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14813 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14814 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14815 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14816 | } |
| 14817 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14818 | #ifdef SND_HDA_NEEDS_RESUME |
| 14819 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14820 | { |
| 14821 | int val = alc_read_coef_idx(codec, 0x04); |
| 14822 | if (power_up) |
| 14823 | val |= 1 << 11; |
| 14824 | else |
| 14825 | val &= ~(1 << 11); |
| 14826 | alc_write_coef_idx(codec, 0x04, val); |
| 14827 | } |
| 14828 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14829 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14830 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14831 | { |
| 14832 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14833 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14834 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14835 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14836 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14837 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14838 | msleep(150); |
| 14839 | } |
| 14840 | |
| 14841 | alc_shutup(codec); |
| 14842 | if (spec && spec->power_hook) |
| 14843 | spec->power_hook(codec); |
| 14844 | return 0; |
| 14845 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14846 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14847 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14848 | static int alc269_resume(struct hda_codec *codec) |
| 14849 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14850 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14851 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14852 | msleep(150); |
| 14853 | } |
| 14854 | |
| 14855 | codec->patch_ops.init(codec); |
| 14856 | |
| 14857 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14858 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14859 | msleep(200); |
| 14860 | } |
| 14861 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14862 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14863 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14864 | |
| 14865 | snd_hda_codec_resume_amp(codec); |
| 14866 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14867 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14868 | return 0; |
| 14869 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14870 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14871 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14872 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14873 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14874 | { |
| 14875 | int coef; |
| 14876 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14877 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14878 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14879 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14880 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14881 | } |
| 14882 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14883 | enum { |
| 14884 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14885 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14886 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14887 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14888 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14889 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14890 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14891 | }; |
| 14892 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14893 | static const struct alc_fixup alc269_fixups[] = { |
| 14894 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14895 | .type = ALC_FIXUP_VERBS, |
| 14896 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14897 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14898 | {} |
| 14899 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14900 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14901 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14902 | .type = ALC_FIXUP_VERBS, |
| 14903 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14904 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14905 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14906 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14907 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14908 | }, |
| 14909 | .chained = true, |
| 14910 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14911 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14912 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14913 | .type = ALC_FIXUP_VERBS, |
| 14914 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14915 | /* Enables internal speaker */ |
| 14916 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14917 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14918 | {} |
| 14919 | } |
| 14920 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14921 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14922 | .type = ALC_FIXUP_SKU, |
| 14923 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14924 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14925 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14926 | .type = ALC_FIXUP_PINS, |
| 14927 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14928 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14929 | { } |
| 14930 | } |
| 14931 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14932 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14933 | .type = ALC_FIXUP_VERBS, |
| 14934 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14935 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14936 | {} |
| 14937 | } |
| 14938 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14939 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14940 | .type = ALC_FIXUP_FUNC, |
| 14941 | .v.func = alc269_fixup_hweq, |
| 14942 | .chained = true, |
| 14943 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14944 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14945 | }; |
| 14946 | |
| 14947 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14948 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14949 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14950 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | abdd8f5 | 2010-09-21 17:38:14 +0200 | [diff] [blame] | 14951 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14952 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14953 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14954 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14955 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14956 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14957 | {} |
| 14958 | }; |
| 14959 | |
| 14960 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14961 | /* |
| 14962 | * configuration and preset |
| 14963 | */ |
| 14964 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14965 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14966 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14967 | [ALC269_AMIC] = "laptop-amic", |
| 14968 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14969 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14970 | [ALC269_LIFEBOOK] = "lifebook", |
| 14971 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14972 | }; |
| 14973 | |
| 14974 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14975 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14976 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14977 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14978 | ALC269_AMIC), |
| 14979 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14980 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14981 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14982 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14983 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14984 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14985 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14986 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14987 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14988 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14989 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14990 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14991 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14992 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14993 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14994 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14995 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14996 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14997 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14998 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14999 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 15000 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 15001 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 15002 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 15003 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 15004 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 15005 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 15006 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 15007 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 15008 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 15009 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 15010 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 15011 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 15012 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 15013 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 15014 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15015 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15016 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15017 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15018 | ALC269_DMIC), |
| 15019 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 15020 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15021 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15022 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 15023 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 15024 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 15025 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 15026 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 15027 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 15028 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15029 | {} |
| 15030 | }; |
| 15031 | |
| 15032 | static struct alc_config_preset alc269_presets[] = { |
| 15033 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15034 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15035 | .init_verbs = { alc269_init_verbs }, |
| 15036 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15037 | .dac_nids = alc269_dac_nids, |
| 15038 | .hp_nid = 0x03, |
| 15039 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15040 | .channel_mode = alc269_modes, |
| 15041 | .input_mux = &alc269_capture_source, |
| 15042 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15043 | [ALC269_QUANTA_FL1] = { |
| 15044 | .mixers = { alc269_quanta_fl1_mixer }, |
| 15045 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 15046 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15047 | .dac_nids = alc269_dac_nids, |
| 15048 | .hp_nid = 0x03, |
| 15049 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15050 | .channel_mode = alc269_modes, |
| 15051 | .input_mux = &alc269_capture_source, |
| 15052 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15053 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15054 | .init_hook = alc269_quanta_fl1_init_hook, |
| 15055 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15056 | [ALC269_AMIC] = { |
| 15057 | .mixers = { alc269_laptop_mixer }, |
| 15058 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15059 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15060 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15061 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15062 | .dac_nids = alc269_dac_nids, |
| 15063 | .hp_nid = 0x03, |
| 15064 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15065 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15066 | .unsol_event = alc269_laptop_unsol_event, |
| 15067 | .setup = alc269_laptop_amic_setup, |
| 15068 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15069 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15070 | [ALC269_DMIC] = { |
| 15071 | .mixers = { alc269_laptop_mixer }, |
| 15072 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15073 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15074 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 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, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15080 | .unsol_event = alc269_laptop_unsol_event, |
| 15081 | .setup = alc269_laptop_dmic_setup, |
| 15082 | .init_hook = alc269_laptop_inithook, |
| 15083 | }, |
| 15084 | [ALC269VB_AMIC] = { |
| 15085 | .mixers = { alc269vb_laptop_mixer }, |
| 15086 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15087 | .init_verbs = { alc269vb_init_verbs, |
| 15088 | alc269vb_laptop_amic_init_verbs }, |
| 15089 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15090 | .dac_nids = alc269_dac_nids, |
| 15091 | .hp_nid = 0x03, |
| 15092 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15093 | .channel_mode = alc269_modes, |
| 15094 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15095 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15096 | .init_hook = alc269_laptop_inithook, |
| 15097 | }, |
| 15098 | [ALC269VB_DMIC] = { |
| 15099 | .mixers = { alc269vb_laptop_mixer }, |
| 15100 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15101 | .init_verbs = { alc269vb_init_verbs, |
| 15102 | alc269vb_laptop_dmic_init_verbs }, |
| 15103 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15104 | .dac_nids = alc269_dac_nids, |
| 15105 | .hp_nid = 0x03, |
| 15106 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15107 | .channel_mode = alc269_modes, |
| 15108 | .unsol_event = alc269_laptop_unsol_event, |
| 15109 | .setup = alc269vb_laptop_dmic_setup, |
| 15110 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15111 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15112 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15113 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15114 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15115 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15116 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15117 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15118 | .dac_nids = alc269_dac_nids, |
| 15119 | .hp_nid = 0x03, |
| 15120 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15121 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15122 | .unsol_event = alc269_laptop_unsol_event, |
| 15123 | .setup = alc269_laptop_dmic_setup, |
| 15124 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15125 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15126 | [ALC269_LIFEBOOK] = { |
| 15127 | .mixers = { alc269_lifebook_mixer }, |
| 15128 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15129 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15130 | .dac_nids = alc269_dac_nids, |
| 15131 | .hp_nid = 0x03, |
| 15132 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15133 | .channel_mode = alc269_modes, |
| 15134 | .input_mux = &alc269_capture_source, |
| 15135 | .unsol_event = alc269_lifebook_unsol_event, |
| 15136 | .init_hook = alc269_lifebook_init_hook, |
| 15137 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15138 | [ALC271_ACER] = { |
| 15139 | .mixers = { alc269_asus_mixer }, |
| 15140 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15141 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15142 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15143 | .dac_nids = alc269_dac_nids, |
| 15144 | .adc_nids = alc262_dmic_adc_nids, |
| 15145 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15146 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15147 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15148 | .channel_mode = alc269_modes, |
| 15149 | .input_mux = &alc269_capture_source, |
| 15150 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15151 | .unsol_event = alc_sku_unsol_event, |
| 15152 | .setup = alc269vb_laptop_dmic_setup, |
| 15153 | .init_hook = alc_inithook, |
| 15154 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15155 | }; |
| 15156 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15157 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15158 | { |
| 15159 | int val; |
| 15160 | |
| 15161 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15162 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15163 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15164 | } |
| 15165 | |
| 15166 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15167 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15168 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15169 | } |
| 15170 | |
| 15171 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15172 | val = alc_read_coef_idx(codec, 0x04); |
| 15173 | /* Power up output pin */ |
| 15174 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15175 | } |
| 15176 | |
| 15177 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15178 | val = alc_read_coef_idx(codec, 0xd); |
| 15179 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15180 | /* Capless ramp up clock control */ |
| 15181 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15182 | } |
| 15183 | val = alc_read_coef_idx(codec, 0x17); |
| 15184 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15185 | /* Class D power on reset */ |
| 15186 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15187 | } |
| 15188 | } |
| 15189 | return 0; |
| 15190 | } |
| 15191 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15192 | static int patch_alc269(struct hda_codec *codec) |
| 15193 | { |
| 15194 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15195 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15196 | int err; |
| 15197 | |
| 15198 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15199 | if (spec == NULL) |
| 15200 | return -ENOMEM; |
| 15201 | |
| 15202 | codec->spec = spec; |
| 15203 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15204 | alc_auto_parse_customize_define(codec); |
| 15205 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15206 | if (codec->vendor_id == 0x10ec0269) { |
| 15207 | coef = alc_read_coef_idx(codec, 0); |
| 15208 | if ((coef & 0x00f0) == 0x0010) { |
| 15209 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15210 | spec->cdefine.platform_type == 1) { |
| 15211 | alc_codec_rename(codec, "ALC271X"); |
| 15212 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15213 | } else if ((coef & 0xf000) == 0x1000) { |
| 15214 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15215 | } else if ((coef & 0xf000) == 0x2000) { |
| 15216 | alc_codec_rename(codec, "ALC259"); |
| 15217 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15218 | } else if ((coef & 0xf000) == 0x3000) { |
| 15219 | alc_codec_rename(codec, "ALC258"); |
| 15220 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15221 | } else { |
| 15222 | alc_codec_rename(codec, "ALC269VB"); |
| 15223 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15224 | } |
| 15225 | } else |
| 15226 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15227 | alc269_fill_coef(codec); |
| 15228 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15229 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15230 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15231 | alc269_models, |
| 15232 | alc269_cfg_tbl); |
| 15233 | |
| 15234 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15235 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15236 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15237 | board_config = ALC269_AUTO; |
| 15238 | } |
| 15239 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15240 | if (board_config == ALC269_AUTO) { |
| 15241 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15242 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15243 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15244 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15245 | if (board_config == ALC269_AUTO) { |
| 15246 | /* automatic parse from the BIOS config */ |
| 15247 | err = alc269_parse_auto_config(codec); |
| 15248 | if (err < 0) { |
| 15249 | alc_free(codec); |
| 15250 | return err; |
| 15251 | } else if (!err) { |
| 15252 | printk(KERN_INFO |
| 15253 | "hda_codec: Cannot set up configuration " |
| 15254 | "from BIOS. Using base mode...\n"); |
| 15255 | board_config = ALC269_BASIC; |
| 15256 | } |
| 15257 | } |
| 15258 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15259 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15260 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15261 | if (err < 0) { |
| 15262 | alc_free(codec); |
| 15263 | return err; |
| 15264 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15265 | } |
| 15266 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15267 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15268 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15269 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15270 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15271 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15272 | * fix the sample rate of analog I/O to 44.1kHz |
| 15273 | */ |
| 15274 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15275 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15276 | } else if (spec->dual_adc_switch) { |
| 15277 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15278 | /* switch ADC dynamically */ |
| 15279 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15280 | } else { |
| 15281 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15282 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15283 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15284 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15285 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15286 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15287 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15288 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15289 | spec->adc_nids = alc269_adc_nids; |
| 15290 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15291 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15292 | } else { |
| 15293 | spec->adc_nids = alc269vb_adc_nids; |
| 15294 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15295 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15296 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15297 | } |
| 15298 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15299 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15300 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15301 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15302 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15303 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15304 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15305 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15306 | spec->vmaster_nid = 0x02; |
| 15307 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15308 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15309 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15310 | codec->patch_ops.suspend = alc269_suspend; |
| 15311 | #endif |
| 15312 | #ifdef SND_HDA_NEEDS_RESUME |
| 15313 | codec->patch_ops.resume = alc269_resume; |
| 15314 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15315 | if (board_config == ALC269_AUTO) |
| 15316 | spec->init_hook = alc269_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15317 | |
| 15318 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15319 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15320 | if (!spec->loopback.amplist) |
| 15321 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15322 | if (alc269_mic2_for_mute_led(codec)) |
| 15323 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15324 | #endif |
| 15325 | |
| 15326 | return 0; |
| 15327 | } |
| 15328 | |
| 15329 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15330 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15331 | */ |
| 15332 | |
| 15333 | /* |
| 15334 | * set the path ways for 2 channel output |
| 15335 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15336 | */ |
| 15337 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15338 | /* set pin widget 1Ah (line in) for input */ |
| 15339 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15340 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15341 | * the vref |
| 15342 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15343 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15344 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15345 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15346 | #if 0 |
| 15347 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15348 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15349 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15350 | { } /* end */ |
| 15351 | }; |
| 15352 | /* |
| 15353 | * 6ch mode |
| 15354 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15355 | */ |
| 15356 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15357 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15358 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15359 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15360 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15361 | |
| 15362 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15363 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15364 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15365 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15366 | #if 0 |
| 15367 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15368 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15369 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15370 | { } /* end */ |
| 15371 | }; |
| 15372 | |
| 15373 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15374 | { 2, alc861_threestack_ch2_init }, |
| 15375 | { 6, alc861_threestack_ch6_init }, |
| 15376 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15377 | /* Set mic1 as input and unmute the mixer */ |
| 15378 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15379 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15380 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15381 | { } /* end */ |
| 15382 | }; |
| 15383 | /* Set mic1 as output and mute mixer */ |
| 15384 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15385 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15386 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15387 | { } /* end */ |
| 15388 | }; |
| 15389 | |
| 15390 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15391 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15392 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15393 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15394 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15395 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15396 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15397 | /* set pin widget 1Ah (line in) for input */ |
| 15398 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15399 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15400 | * the vref |
| 15401 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15402 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15403 | |
| 15404 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15405 | #if 0 |
| 15406 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15407 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15408 | #endif |
| 15409 | { } /* end */ |
| 15410 | }; |
| 15411 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15412 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15413 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15414 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15415 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15416 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15417 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15418 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15419 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15420 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15421 | |
| 15422 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15423 | #if 0 |
| 15424 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15425 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15426 | #endif |
| 15427 | { } /* end */ |
| 15428 | }; |
| 15429 | |
| 15430 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15431 | { 2, alc861_asus_ch2_init }, |
| 15432 | { 6, alc861_asus_ch6_init }, |
| 15433 | }; |
| 15434 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15435 | /* patch-ALC861 */ |
| 15436 | |
| 15437 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15438 | /* output mixer control */ |
| 15439 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15440 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15441 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15442 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15443 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15444 | |
| 15445 | /*Input mixer control */ |
| 15446 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15447 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15448 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15449 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15450 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15451 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15452 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15453 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15454 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15455 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15456 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15457 | { } /* end */ |
| 15458 | }; |
| 15459 | |
| 15460 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15461 | /* output mixer control */ |
| 15462 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15463 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15464 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15465 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15466 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15467 | |
| 15468 | /* Input mixer control */ |
| 15469 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15470 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15471 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15472 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15473 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15474 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15475 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15476 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15477 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15478 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15479 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15480 | { |
| 15481 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15482 | .name = "Channel Mode", |
| 15483 | .info = alc_ch_mode_info, |
| 15484 | .get = alc_ch_mode_get, |
| 15485 | .put = alc_ch_mode_put, |
| 15486 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15487 | }, |
| 15488 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15489 | }; |
| 15490 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15491 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15492 | /* output mixer control */ |
| 15493 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15494 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15495 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15496 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15497 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15498 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15499 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15500 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15501 | /* output mixer control */ |
| 15502 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15503 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15504 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15505 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15506 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15507 | |
| 15508 | /* Input mixer control */ |
| 15509 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15510 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15511 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15512 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15513 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15514 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15515 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15516 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15517 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15518 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15519 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15520 | { |
| 15521 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15522 | .name = "Channel Mode", |
| 15523 | .info = alc_ch_mode_info, |
| 15524 | .get = alc_ch_mode_get, |
| 15525 | .put = alc_ch_mode_put, |
| 15526 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15527 | }, |
| 15528 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15529 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15530 | |
| 15531 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15532 | /* output mixer control */ |
| 15533 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15534 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15535 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15536 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15537 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15538 | |
| 15539 | /* Input mixer control */ |
| 15540 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15541 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15542 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15543 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15544 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15545 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15546 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15548 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15549 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15550 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15551 | { |
| 15552 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15553 | .name = "Channel Mode", |
| 15554 | .info = alc_ch_mode_info, |
| 15555 | .get = alc_ch_mode_get, |
| 15556 | .put = alc_ch_mode_put, |
| 15557 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15558 | }, |
| 15559 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15560 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15561 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15562 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15563 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15564 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15565 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15566 | { } |
| 15567 | }; |
| 15568 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15569 | /* |
| 15570 | * generic initialization of ADC, input mixers and output mixers |
| 15571 | */ |
| 15572 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15573 | /* |
| 15574 | * Unmute ADC0 and set the default input to mic-in |
| 15575 | */ |
| 15576 | /* port-A for surround (rear panel) */ |
| 15577 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15578 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15579 | /* port-B for mic-in (rear panel) with vref */ |
| 15580 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15581 | /* port-C for line-in (rear panel) */ |
| 15582 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15583 | /* port-D for Front */ |
| 15584 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15585 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15586 | /* port-E for HP out (front panel) */ |
| 15587 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15588 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15589 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15590 | /* port-F for mic-in (front panel) with vref */ |
| 15591 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15592 | /* port-G for CLFE (rear panel) */ |
| 15593 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15594 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15595 | /* port-H for side (rear panel) */ |
| 15596 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15597 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15598 | /* CD-in */ |
| 15599 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15600 | /* route front mic to ADC1*/ |
| 15601 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15602 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15603 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15604 | /* Unmute DAC0~3 & spdif out*/ |
| 15605 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15606 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15607 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15608 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15609 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15610 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15611 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15612 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15613 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15614 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15615 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15616 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15617 | /* Unmute Stereo Mixer 15 */ |
| 15618 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15619 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15620 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15621 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15622 | |
| 15623 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15624 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15625 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15626 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15627 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15628 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15629 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15630 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15631 | /* hp used DAC 3 (Front) */ |
| 15632 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15633 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15634 | |
| 15635 | { } |
| 15636 | }; |
| 15637 | |
| 15638 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15639 | /* |
| 15640 | * Unmute ADC0 and set the default input to mic-in |
| 15641 | */ |
| 15642 | /* port-A for surround (rear panel) */ |
| 15643 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15644 | /* port-B for mic-in (rear panel) with vref */ |
| 15645 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15646 | /* port-C for line-in (rear panel) */ |
| 15647 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15648 | /* port-D for Front */ |
| 15649 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15650 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15651 | /* port-E for HP out (front panel) */ |
| 15652 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15653 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15654 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15655 | /* port-F for mic-in (front panel) with vref */ |
| 15656 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15657 | /* port-G for CLFE (rear panel) */ |
| 15658 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15659 | /* port-H for side (rear panel) */ |
| 15660 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15661 | /* CD-in */ |
| 15662 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15663 | /* route front mic to ADC1*/ |
| 15664 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15665 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15666 | /* Unmute DAC0~3 & spdif out*/ |
| 15667 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15668 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15669 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15670 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15671 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15672 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15673 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15674 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15675 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15676 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15677 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15678 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15679 | /* Unmute Stereo Mixer 15 */ |
| 15680 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15681 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15682 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15683 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15684 | |
| 15685 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15686 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15687 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15688 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15689 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15690 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15691 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15692 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15693 | /* hp used DAC 3 (Front) */ |
| 15694 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15695 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15696 | { } |
| 15697 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15698 | |
| 15699 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15700 | /* |
| 15701 | * Unmute ADC0 and set the default input to mic-in |
| 15702 | */ |
| 15703 | /* port-A for surround (rear panel) */ |
| 15704 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15705 | /* port-B for mic-in (rear panel) with vref */ |
| 15706 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15707 | /* port-C for line-in (rear panel) */ |
| 15708 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15709 | /* port-D for Front */ |
| 15710 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15711 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15712 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15713 | /* this has to be set to VREF80 */ |
| 15714 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15715 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15716 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15717 | /* port-F for mic-in (front panel) with vref */ |
| 15718 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15719 | /* port-G for CLFE (rear panel) */ |
| 15720 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15721 | /* port-H for side (rear panel) */ |
| 15722 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15723 | /* CD-in */ |
| 15724 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15725 | /* route front mic to ADC1*/ |
| 15726 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15727 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15728 | /* Unmute DAC0~3 & spdif out*/ |
| 15729 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15730 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15731 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15732 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15733 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15734 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15735 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15736 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15737 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15738 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15739 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15740 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15741 | /* Unmute Stereo Mixer 15 */ |
| 15742 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15743 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15744 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15745 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15746 | |
| 15747 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15748 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15749 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15750 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15751 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15752 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15753 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15754 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15755 | /* hp used DAC 3 (Front) */ |
| 15756 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15757 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15758 | { } |
| 15759 | }; |
| 15760 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15761 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15762 | /* |
| 15763 | * Unmute ADC0 and set the default input to mic-in |
| 15764 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15765 | /* port-A for surround (rear panel) |
| 15766 | * according to codec#0 this is the HP jack |
| 15767 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15768 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15769 | /* route front PCM to HP */ |
| 15770 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15771 | /* port-B for mic-in (rear panel) with vref */ |
| 15772 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15773 | /* port-C for line-in (rear panel) */ |
| 15774 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15775 | /* port-D for Front */ |
| 15776 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15777 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15778 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15779 | /* this has to be set to VREF80 */ |
| 15780 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15781 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15782 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15783 | /* port-F for mic-in (front panel) with vref */ |
| 15784 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15785 | /* port-G for CLFE (rear panel) */ |
| 15786 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15787 | /* port-H for side (rear panel) */ |
| 15788 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15789 | /* CD-in */ |
| 15790 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15791 | /* route front mic to ADC1*/ |
| 15792 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15793 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15794 | /* Unmute DAC0~3 & spdif out*/ |
| 15795 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15796 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15797 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15798 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15799 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15800 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15801 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15802 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15803 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15804 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15805 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15806 | /* Unmute Stereo Mixer 15 */ |
| 15807 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15808 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15809 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15810 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15811 | |
| 15812 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15813 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15814 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15815 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15817 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15818 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15820 | /* hp used DAC 3 (Front) */ |
| 15821 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15822 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15823 | { } |
| 15824 | }; |
| 15825 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15826 | /* additional init verbs for ASUS laptops */ |
| 15827 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15828 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15829 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15830 | { } |
| 15831 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15832 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15833 | /* |
| 15834 | * generic initialization of ADC, input mixers and output mixers |
| 15835 | */ |
| 15836 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15837 | /* |
| 15838 | * Unmute ADC0 and set the default input to mic-in |
| 15839 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15840 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15841 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15842 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15843 | /* Unmute DAC0~3 & spdif out*/ |
| 15844 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15845 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15846 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15847 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15848 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15849 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15850 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15851 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15852 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15853 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15854 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15855 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15856 | /* Unmute Stereo Mixer 15 */ |
| 15857 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15858 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15859 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15860 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15861 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15862 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15863 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15864 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15865 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15866 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15867 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15868 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15869 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15870 | |
| 15871 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15872 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15873 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15874 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15875 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15876 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15877 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15878 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15879 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15880 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15881 | |
| 15882 | { } |
| 15883 | }; |
| 15884 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15885 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15886 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15887 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15888 | { } |
| 15889 | }; |
| 15890 | |
| 15891 | /* toggle speaker-output according to the hp-jack state */ |
| 15892 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15893 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15894 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15895 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15896 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15897 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15898 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15899 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15900 | } |
| 15901 | |
| 15902 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15903 | unsigned int res) |
| 15904 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15905 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15906 | alc861_toshiba_automute(codec); |
| 15907 | } |
| 15908 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15909 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15910 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15911 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15912 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15913 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15914 | |
| 15915 | |
| 15916 | #define ALC861_DIGOUT_NID 0x07 |
| 15917 | |
| 15918 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15919 | { 8, NULL } |
| 15920 | }; |
| 15921 | |
| 15922 | static hda_nid_t alc861_dac_nids[4] = { |
| 15923 | /* front, surround, clfe, side */ |
| 15924 | 0x03, 0x06, 0x05, 0x04 |
| 15925 | }; |
| 15926 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15927 | static hda_nid_t alc660_dac_nids[3] = { |
| 15928 | /* front, clfe, surround */ |
| 15929 | 0x03, 0x05, 0x06 |
| 15930 | }; |
| 15931 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15932 | static hda_nid_t alc861_adc_nids[1] = { |
| 15933 | /* ADC0-2 */ |
| 15934 | 0x08, |
| 15935 | }; |
| 15936 | |
| 15937 | static struct hda_input_mux alc861_capture_source = { |
| 15938 | .num_items = 5, |
| 15939 | .items = { |
| 15940 | { "Mic", 0x0 }, |
| 15941 | { "Front Mic", 0x3 }, |
| 15942 | { "Line", 0x1 }, |
| 15943 | { "CD", 0x4 }, |
| 15944 | { "Mixer", 0x5 }, |
| 15945 | }, |
| 15946 | }; |
| 15947 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15948 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15949 | { |
| 15950 | struct alc_spec *spec = codec->spec; |
| 15951 | hda_nid_t mix, srcs[5]; |
| 15952 | int i, j, num; |
| 15953 | |
| 15954 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15955 | return 0; |
| 15956 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15957 | if (num < 0) |
| 15958 | return 0; |
| 15959 | for (i = 0; i < num; i++) { |
| 15960 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15961 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15962 | if (type != AC_WID_AUD_OUT) |
| 15963 | continue; |
| 15964 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15965 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15966 | break; |
| 15967 | if (j >= spec->multiout.num_dacs) |
| 15968 | return srcs[i]; |
| 15969 | } |
| 15970 | return 0; |
| 15971 | } |
| 15972 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15973 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15974 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15975 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15976 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15977 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15978 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15979 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15980 | |
| 15981 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15982 | for (i = 0; i < cfg->line_outs; i++) { |
| 15983 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15984 | dac = alc861_look_for_dac(codec, nid); |
| 15985 | if (!dac) |
| 15986 | continue; |
| 15987 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15988 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15989 | return 0; |
| 15990 | } |
| 15991 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15992 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15993 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15994 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15995 | 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] | 15996 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15997 | } |
| 15998 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15999 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 16000 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 16001 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16002 | /* add playback controls from the parsed DAC table */ |
| 16003 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 16004 | const struct auto_pin_cfg *cfg) |
| 16005 | { |
| 16006 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16007 | static const char *chname[4] = { |
| 16008 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16009 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16010 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16011 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16012 | int i, err; |
| 16013 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16014 | for (i = 0; i < cfg->line_outs; i++) { |
| 16015 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16016 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16017 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16018 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16019 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16020 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16021 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16022 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16023 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16024 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16025 | return err; |
| 16026 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16027 | const char *name = pfx; |
| 16028 | if (!name) |
| 16029 | name = chname[i]; |
| 16030 | err = __alc861_create_out_sw(codec, name, nid, i, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16031 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16032 | return err; |
| 16033 | } |
| 16034 | } |
| 16035 | return 0; |
| 16036 | } |
| 16037 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16038 | 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] | 16039 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16040 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16041 | int err; |
| 16042 | hda_nid_t nid; |
| 16043 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16044 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16045 | return 0; |
| 16046 | |
| 16047 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16048 | nid = alc861_look_for_dac(codec, pin); |
| 16049 | if (nid) { |
| 16050 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 16051 | if (err < 0) |
| 16052 | return err; |
| 16053 | spec->multiout.hp_nid = nid; |
| 16054 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16055 | } |
| 16056 | return 0; |
| 16057 | } |
| 16058 | |
| 16059 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16060 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16061 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16062 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16063 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16064 | } |
| 16065 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16066 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16067 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16068 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16069 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16070 | hda_nid_t mix, srcs[5]; |
| 16071 | int i, num; |
| 16072 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16073 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16074 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16075 | 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] | 16076 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16077 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 16078 | return; |
| 16079 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 16080 | if (num < 0) |
| 16081 | return; |
| 16082 | for (i = 0; i < num; i++) { |
| 16083 | unsigned int mute; |
| 16084 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 16085 | mute = AMP_IN_UNMUTE(i); |
| 16086 | else |
| 16087 | mute = AMP_IN_MUTE(i); |
| 16088 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16089 | mute); |
| 16090 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16091 | } |
| 16092 | |
| 16093 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 16094 | { |
| 16095 | struct alc_spec *spec = codec->spec; |
| 16096 | int i; |
| 16097 | |
| 16098 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 16099 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16100 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16101 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16102 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16103 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16104 | } |
| 16105 | } |
| 16106 | |
| 16107 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 16108 | { |
| 16109 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16110 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16111 | if (spec->autocfg.hp_outs) |
| 16112 | alc861_auto_set_output_and_unmute(codec, |
| 16113 | spec->autocfg.hp_pins[0], |
| 16114 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16115 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16116 | if (spec->autocfg.speaker_outs) |
| 16117 | alc861_auto_set_output_and_unmute(codec, |
| 16118 | spec->autocfg.speaker_pins[0], |
| 16119 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16120 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16121 | } |
| 16122 | |
| 16123 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16124 | { |
| 16125 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16126 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16127 | int i; |
| 16128 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16129 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16130 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16131 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16132 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16133 | } |
| 16134 | } |
| 16135 | |
| 16136 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16137 | /* return 1 if successful, 0 if the proper config is not found, |
| 16138 | * or a negative error code |
| 16139 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16140 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16141 | { |
| 16142 | struct alc_spec *spec = codec->spec; |
| 16143 | int err; |
| 16144 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 16145 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16146 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16147 | alc861_ignore); |
| 16148 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16149 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16150 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16151 | return 0; /* can't find valid BIOS pin config */ |
| 16152 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16153 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16154 | if (err < 0) |
| 16155 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16156 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16157 | if (err < 0) |
| 16158 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16159 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16160 | if (err < 0) |
| 16161 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16162 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16163 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16164 | return err; |
| 16165 | |
| 16166 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16167 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16168 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16169 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16170 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16171 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16172 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16173 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16174 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16175 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16176 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16177 | |
| 16178 | spec->adc_nids = alc861_adc_nids; |
| 16179 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16180 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16181 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16182 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16183 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16184 | return 1; |
| 16185 | } |
| 16186 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16187 | /* additional initialization for auto-configuration model */ |
| 16188 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16189 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16190 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16191 | alc861_auto_init_multi_out(codec); |
| 16192 | alc861_auto_init_hp_out(codec); |
| 16193 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16194 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16195 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16196 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16197 | } |
| 16198 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16199 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16200 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16201 | { 0x15, HDA_INPUT, 0 }, |
| 16202 | { 0x15, HDA_INPUT, 1 }, |
| 16203 | { 0x15, HDA_INPUT, 2 }, |
| 16204 | { 0x15, HDA_INPUT, 3 }, |
| 16205 | { } /* end */ |
| 16206 | }; |
| 16207 | #endif |
| 16208 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16209 | |
| 16210 | /* |
| 16211 | * configuration and preset |
| 16212 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16213 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 16214 | [ALC861_3ST] = "3stack", |
| 16215 | [ALC660_3ST] = "3stack-660", |
| 16216 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16217 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16218 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16219 | [ALC861_TOSHIBA] = "toshiba", |
| 16220 | [ALC861_ASUS] = "asus", |
| 16221 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16222 | [ALC861_AUTO] = "auto", |
| 16223 | }; |
| 16224 | |
| 16225 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16226 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16227 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16228 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16229 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16230 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16231 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16232 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16233 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16234 | * Any other models that need this preset? |
| 16235 | */ |
| 16236 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16237 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16238 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16239 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16240 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16241 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16242 | /* FIXME: the below seems conflict */ |
| 16243 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16244 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16245 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16246 | {} |
| 16247 | }; |
| 16248 | |
| 16249 | static struct alc_config_preset alc861_presets[] = { |
| 16250 | [ALC861_3ST] = { |
| 16251 | .mixers = { alc861_3ST_mixer }, |
| 16252 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16253 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16254 | .dac_nids = alc861_dac_nids, |
| 16255 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16256 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16257 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16258 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16259 | .adc_nids = alc861_adc_nids, |
| 16260 | .input_mux = &alc861_capture_source, |
| 16261 | }, |
| 16262 | [ALC861_3ST_DIG] = { |
| 16263 | .mixers = { alc861_base_mixer }, |
| 16264 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16265 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16266 | .dac_nids = alc861_dac_nids, |
| 16267 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16268 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16269 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16270 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16271 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16272 | .adc_nids = alc861_adc_nids, |
| 16273 | .input_mux = &alc861_capture_source, |
| 16274 | }, |
| 16275 | [ALC861_6ST_DIG] = { |
| 16276 | .mixers = { alc861_base_mixer }, |
| 16277 | .init_verbs = { alc861_base_init_verbs }, |
| 16278 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16279 | .dac_nids = alc861_dac_nids, |
| 16280 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16281 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16282 | .channel_mode = alc861_8ch_modes, |
| 16283 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16284 | .adc_nids = alc861_adc_nids, |
| 16285 | .input_mux = &alc861_capture_source, |
| 16286 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16287 | [ALC660_3ST] = { |
| 16288 | .mixers = { alc861_3ST_mixer }, |
| 16289 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16290 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16291 | .dac_nids = alc660_dac_nids, |
| 16292 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16293 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16294 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16295 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16296 | .adc_nids = alc861_adc_nids, |
| 16297 | .input_mux = &alc861_capture_source, |
| 16298 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16299 | [ALC861_UNIWILL_M31] = { |
| 16300 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16301 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16302 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16303 | .dac_nids = alc861_dac_nids, |
| 16304 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16305 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16306 | .channel_mode = alc861_uniwill_m31_modes, |
| 16307 | .need_dac_fix = 1, |
| 16308 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16309 | .adc_nids = alc861_adc_nids, |
| 16310 | .input_mux = &alc861_capture_source, |
| 16311 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16312 | [ALC861_TOSHIBA] = { |
| 16313 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16314 | .init_verbs = { alc861_base_init_verbs, |
| 16315 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16316 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16317 | .dac_nids = alc861_dac_nids, |
| 16318 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16319 | .channel_mode = alc883_3ST_2ch_modes, |
| 16320 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16321 | .adc_nids = alc861_adc_nids, |
| 16322 | .input_mux = &alc861_capture_source, |
| 16323 | .unsol_event = alc861_toshiba_unsol_event, |
| 16324 | .init_hook = alc861_toshiba_automute, |
| 16325 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16326 | [ALC861_ASUS] = { |
| 16327 | .mixers = { alc861_asus_mixer }, |
| 16328 | .init_verbs = { alc861_asus_init_verbs }, |
| 16329 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16330 | .dac_nids = alc861_dac_nids, |
| 16331 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16332 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16333 | .channel_mode = alc861_asus_modes, |
| 16334 | .need_dac_fix = 1, |
| 16335 | .hp_nid = 0x06, |
| 16336 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16337 | .adc_nids = alc861_adc_nids, |
| 16338 | .input_mux = &alc861_capture_source, |
| 16339 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16340 | [ALC861_ASUS_LAPTOP] = { |
| 16341 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16342 | .init_verbs = { alc861_asus_init_verbs, |
| 16343 | alc861_asus_laptop_init_verbs }, |
| 16344 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16345 | .dac_nids = alc861_dac_nids, |
| 16346 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16347 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16348 | .channel_mode = alc883_3ST_2ch_modes, |
| 16349 | .need_dac_fix = 1, |
| 16350 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16351 | .adc_nids = alc861_adc_nids, |
| 16352 | .input_mux = &alc861_capture_source, |
| 16353 | }, |
| 16354 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16355 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16356 | /* Pin config fixes */ |
| 16357 | enum { |
| 16358 | PINFIX_FSC_AMILO_PI1505, |
| 16359 | }; |
| 16360 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16361 | static const struct alc_fixup alc861_fixups[] = { |
| 16362 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16363 | .type = ALC_FIXUP_PINS, |
| 16364 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16365 | { 0x0b, 0x0221101f }, /* HP */ |
| 16366 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16367 | { } |
| 16368 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16369 | }, |
| 16370 | }; |
| 16371 | |
| 16372 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16373 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16374 | {} |
| 16375 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16376 | |
| 16377 | static int patch_alc861(struct hda_codec *codec) |
| 16378 | { |
| 16379 | struct alc_spec *spec; |
| 16380 | int board_config; |
| 16381 | int err; |
| 16382 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16383 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16384 | if (spec == NULL) |
| 16385 | return -ENOMEM; |
| 16386 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16387 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16388 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16389 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16390 | alc861_models, |
| 16391 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16392 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16393 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16394 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16395 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16396 | board_config = ALC861_AUTO; |
| 16397 | } |
| 16398 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16399 | if (board_config == ALC861_AUTO) { |
| 16400 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16401 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16402 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16403 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16404 | if (board_config == ALC861_AUTO) { |
| 16405 | /* automatic parse from the BIOS config */ |
| 16406 | err = alc861_parse_auto_config(codec); |
| 16407 | if (err < 0) { |
| 16408 | alc_free(codec); |
| 16409 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16410 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16411 | printk(KERN_INFO |
| 16412 | "hda_codec: Cannot set up configuration " |
| 16413 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16414 | board_config = ALC861_3ST_DIG; |
| 16415 | } |
| 16416 | } |
| 16417 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16418 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16419 | if (err < 0) { |
| 16420 | alc_free(codec); |
| 16421 | return err; |
| 16422 | } |
| 16423 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16424 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16425 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16426 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16427 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16428 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16429 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16430 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16431 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16432 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16433 | if (!spec->cap_mixer) |
| 16434 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16435 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16436 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16437 | spec->vmaster_nid = 0x03; |
| 16438 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16439 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16440 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16441 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16442 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16443 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16444 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16445 | spec->power_hook = alc_power_eapd; |
| 16446 | #endif |
| 16447 | } |
| 16448 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16449 | if (!spec->loopback.amplist) |
| 16450 | spec->loopback.amplist = alc861_loopbacks; |
| 16451 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16452 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16453 | return 0; |
| 16454 | } |
| 16455 | |
| 16456 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16457 | * ALC861-VD support |
| 16458 | * |
| 16459 | * Based on ALC882 |
| 16460 | * |
| 16461 | * In addition, an independent DAC |
| 16462 | */ |
| 16463 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16464 | |
| 16465 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16466 | /* front, surr, clfe, side surr */ |
| 16467 | 0x02, 0x03, 0x04, 0x05 |
| 16468 | }; |
| 16469 | |
| 16470 | /* dac_nids for ALC660vd are in a different order - according to |
| 16471 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16472 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16473 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16474 | * - and it is the same as in 861vd. |
| 16475 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16476 | */ |
| 16477 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16478 | /* front, rear, clfe, rear_surr */ |
| 16479 | 0x02, 0x04, 0x03 |
| 16480 | }; |
| 16481 | |
| 16482 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16483 | /* ADC0 */ |
| 16484 | 0x09, |
| 16485 | }; |
| 16486 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16487 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16488 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16489 | /* input MUX */ |
| 16490 | /* FIXME: should be a matrix-type input source selection */ |
| 16491 | static struct hda_input_mux alc861vd_capture_source = { |
| 16492 | .num_items = 4, |
| 16493 | .items = { |
| 16494 | { "Mic", 0x0 }, |
| 16495 | { "Front Mic", 0x1 }, |
| 16496 | { "Line", 0x2 }, |
| 16497 | { "CD", 0x4 }, |
| 16498 | }, |
| 16499 | }; |
| 16500 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16501 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16502 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16503 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16504 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16505 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16506 | }, |
| 16507 | }; |
| 16508 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16509 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16510 | .num_items = 2, |
| 16511 | .items = { |
| 16512 | { "Front Mic", 0x0 }, |
| 16513 | { "ATAPI Mic", 0x1 }, |
| 16514 | }, |
| 16515 | }; |
| 16516 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16517 | /* |
| 16518 | * 2ch mode |
| 16519 | */ |
| 16520 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16521 | { 2, NULL } |
| 16522 | }; |
| 16523 | |
| 16524 | /* |
| 16525 | * 6ch mode |
| 16526 | */ |
| 16527 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16528 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16529 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16530 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16531 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16532 | { } /* end */ |
| 16533 | }; |
| 16534 | |
| 16535 | /* |
| 16536 | * 8ch mode |
| 16537 | */ |
| 16538 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16539 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16540 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16541 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16542 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16543 | { } /* end */ |
| 16544 | }; |
| 16545 | |
| 16546 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16547 | { 6, alc861vd_6stack_ch6_init }, |
| 16548 | { 8, alc861vd_6stack_ch8_init }, |
| 16549 | }; |
| 16550 | |
| 16551 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16552 | { |
| 16553 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16554 | .name = "Channel Mode", |
| 16555 | .info = alc_ch_mode_info, |
| 16556 | .get = alc_ch_mode_get, |
| 16557 | .put = alc_ch_mode_put, |
| 16558 | }, |
| 16559 | { } /* end */ |
| 16560 | }; |
| 16561 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16562 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16563 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16564 | */ |
| 16565 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16566 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16567 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16568 | |
| 16569 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16570 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16571 | |
| 16572 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16573 | HDA_OUTPUT), |
| 16574 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16575 | HDA_OUTPUT), |
| 16576 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16577 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16578 | |
| 16579 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16580 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16581 | |
| 16582 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16583 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16584 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16585 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16586 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16587 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16588 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16589 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16590 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16591 | |
| 16592 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16593 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16594 | |
| 16595 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16596 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16597 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16598 | { } /* end */ |
| 16599 | }; |
| 16600 | |
| 16601 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16602 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16603 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16604 | |
| 16605 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16606 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16607 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16608 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16609 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16610 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16611 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16612 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16613 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16614 | |
| 16615 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16616 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16617 | |
| 16618 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16619 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16620 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16621 | { } /* end */ |
| 16622 | }; |
| 16623 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16624 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16625 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16626 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16627 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16628 | |
| 16629 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16630 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16631 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16632 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16633 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16634 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16635 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16636 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16637 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16638 | |
| 16639 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16640 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16641 | |
| 16642 | { } /* end */ |
| 16643 | }; |
| 16644 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16645 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16646 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16647 | */ |
| 16648 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16649 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16650 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16651 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16652 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16653 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16654 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16655 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16656 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16657 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16658 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16659 | { } /* end */ |
| 16660 | }; |
| 16661 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16662 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16663 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16664 | */ |
| 16665 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16666 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16667 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16668 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16669 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16670 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16671 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16672 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16673 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16674 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16675 | { } /* end */ |
| 16676 | }; |
| 16677 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16678 | /* |
| 16679 | * generic initialization of ADC, input mixers and output mixers |
| 16680 | */ |
| 16681 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16682 | /* |
| 16683 | * Unmute ADC0 and set the default input to mic-in |
| 16684 | */ |
| 16685 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16686 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16687 | |
| 16688 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16689 | * the analog-loopback mixer widget |
| 16690 | */ |
| 16691 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16692 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16693 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16694 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16695 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16696 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16697 | |
| 16698 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16699 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16700 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16701 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16702 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16703 | |
| 16704 | /* |
| 16705 | * Set up output mixers (0x02 - 0x05) |
| 16706 | */ |
| 16707 | /* set vol=0 to output mixers */ |
| 16708 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16709 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16710 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16711 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16712 | |
| 16713 | /* set up input amps for analog loopback */ |
| 16714 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16715 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16716 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16717 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16718 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16719 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16720 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16721 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16722 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16723 | |
| 16724 | { } |
| 16725 | }; |
| 16726 | |
| 16727 | /* |
| 16728 | * 3-stack pin configuration: |
| 16729 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16730 | */ |
| 16731 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16732 | /* |
| 16733 | * Set pin mode and muting |
| 16734 | */ |
| 16735 | /* set front pin widgets 0x14 for output */ |
| 16736 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16737 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16738 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16739 | |
| 16740 | /* Mic (rear) pin: input vref at 80% */ |
| 16741 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16742 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16743 | /* Front Mic pin: input vref at 80% */ |
| 16744 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16745 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16746 | /* Line In pin: input */ |
| 16747 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16748 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16749 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16750 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16751 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16752 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16753 | /* CD pin widget for input */ |
| 16754 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16755 | |
| 16756 | { } |
| 16757 | }; |
| 16758 | |
| 16759 | /* |
| 16760 | * 6-stack pin configuration: |
| 16761 | */ |
| 16762 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16763 | /* |
| 16764 | * Set pin mode and muting |
| 16765 | */ |
| 16766 | /* set front pin widgets 0x14 for output */ |
| 16767 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16768 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16769 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16770 | |
| 16771 | /* Rear Pin: output 1 (0x0d) */ |
| 16772 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16774 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16775 | /* CLFE Pin: output 2 (0x0e) */ |
| 16776 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16777 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16778 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16779 | /* Side Pin: output 3 (0x0f) */ |
| 16780 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16781 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16782 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16783 | |
| 16784 | /* Mic (rear) pin: input vref at 80% */ |
| 16785 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16786 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16787 | /* Front Mic pin: input vref at 80% */ |
| 16788 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16789 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16790 | /* Line In pin: input */ |
| 16791 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16792 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16793 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16794 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16795 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16796 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16797 | /* CD pin widget for input */ |
| 16798 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16799 | |
| 16800 | { } |
| 16801 | }; |
| 16802 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16803 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16804 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16805 | { } |
| 16806 | }; |
| 16807 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16808 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16809 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16810 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16811 | { } |
| 16812 | }; |
| 16813 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16814 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16815 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16816 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16817 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16818 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16819 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16820 | {} |
| 16821 | }; |
| 16822 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16823 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16824 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16825 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16826 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16827 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16828 | } |
| 16829 | |
| 16830 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16831 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16832 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16833 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16834 | } |
| 16835 | |
| 16836 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16837 | unsigned int res) |
| 16838 | { |
| 16839 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16840 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16841 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16842 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16843 | default: |
| 16844 | alc_automute_amp_unsol_event(codec, res); |
| 16845 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16846 | } |
| 16847 | } |
| 16848 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16849 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16850 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16851 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16852 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16853 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16854 | |
| 16855 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16856 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16857 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16858 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16859 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16860 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16861 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16862 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16863 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16864 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16865 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16866 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16867 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16868 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16869 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16870 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16871 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16872 | |
| 16873 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16874 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16875 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16876 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16877 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16878 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16879 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16880 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16881 | |
| 16882 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16883 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16884 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16885 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16886 | |
| 16887 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16888 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16889 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16890 | |
| 16891 | { } /* end */ |
| 16892 | }; |
| 16893 | |
| 16894 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16895 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16896 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16897 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16898 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16899 | spec->autocfg.hp_pins[0] = 0x15; |
| 16900 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16901 | } |
| 16902 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16903 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16904 | #define alc861vd_loopbacks alc880_loopbacks |
| 16905 | #endif |
| 16906 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16907 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16908 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16909 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16910 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16911 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16912 | |
| 16913 | /* |
| 16914 | * configuration and preset |
| 16915 | */ |
| 16916 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16917 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16918 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16919 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16920 | [ALC861VD_3ST] = "3stack", |
| 16921 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16922 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16923 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16924 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16925 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16926 | [ALC861VD_AUTO] = "auto", |
| 16927 | }; |
| 16928 | |
| 16929 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16930 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16931 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16932 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16933 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16934 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16935 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16936 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16937 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16938 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16939 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16940 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16941 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16942 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16943 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16944 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16945 | {} |
| 16946 | }; |
| 16947 | |
| 16948 | static struct alc_config_preset alc861vd_presets[] = { |
| 16949 | [ALC660VD_3ST] = { |
| 16950 | .mixers = { alc861vd_3st_mixer }, |
| 16951 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16952 | alc861vd_3stack_init_verbs }, |
| 16953 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16954 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16955 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16956 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16957 | .input_mux = &alc861vd_capture_source, |
| 16958 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16959 | [ALC660VD_3ST_DIG] = { |
| 16960 | .mixers = { alc861vd_3st_mixer }, |
| 16961 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16962 | alc861vd_3stack_init_verbs }, |
| 16963 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16964 | .dac_nids = alc660vd_dac_nids, |
| 16965 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16966 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16967 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16968 | .input_mux = &alc861vd_capture_source, |
| 16969 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16970 | [ALC861VD_3ST] = { |
| 16971 | .mixers = { alc861vd_3st_mixer }, |
| 16972 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16973 | alc861vd_3stack_init_verbs }, |
| 16974 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16975 | .dac_nids = alc861vd_dac_nids, |
| 16976 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16977 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16978 | .input_mux = &alc861vd_capture_source, |
| 16979 | }, |
| 16980 | [ALC861VD_3ST_DIG] = { |
| 16981 | .mixers = { alc861vd_3st_mixer }, |
| 16982 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16983 | alc861vd_3stack_init_verbs }, |
| 16984 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16985 | .dac_nids = alc861vd_dac_nids, |
| 16986 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16987 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16988 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16989 | .input_mux = &alc861vd_capture_source, |
| 16990 | }, |
| 16991 | [ALC861VD_6ST_DIG] = { |
| 16992 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16993 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16994 | alc861vd_6stack_init_verbs }, |
| 16995 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16996 | .dac_nids = alc861vd_dac_nids, |
| 16997 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16998 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16999 | .channel_mode = alc861vd_6stack_modes, |
| 17000 | .input_mux = &alc861vd_capture_source, |
| 17001 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17002 | [ALC861VD_LENOVO] = { |
| 17003 | .mixers = { alc861vd_lenovo_mixer }, |
| 17004 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17005 | alc861vd_3stack_init_verbs, |
| 17006 | alc861vd_eapd_verbs, |
| 17007 | alc861vd_lenovo_unsol_verbs }, |
| 17008 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17009 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17010 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17011 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17012 | .input_mux = &alc861vd_capture_source, |
| 17013 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17014 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17015 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17016 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17017 | [ALC861VD_DALLAS] = { |
| 17018 | .mixers = { alc861vd_dallas_mixer }, |
| 17019 | .init_verbs = { alc861vd_dallas_verbs }, |
| 17020 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17021 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17022 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17023 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17024 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17025 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17026 | .setup = alc861vd_dallas_setup, |
| 17027 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17028 | }, |
| 17029 | [ALC861VD_HP] = { |
| 17030 | .mixers = { alc861vd_hp_mixer }, |
| 17031 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 17032 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17033 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17034 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17035 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17036 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17037 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17038 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17039 | .setup = alc861vd_dallas_setup, |
| 17040 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17041 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17042 | [ALC660VD_ASUS_V1S] = { |
| 17043 | .mixers = { alc861vd_lenovo_mixer }, |
| 17044 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17045 | alc861vd_3stack_init_verbs, |
| 17046 | alc861vd_eapd_verbs, |
| 17047 | alc861vd_lenovo_unsol_verbs }, |
| 17048 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17049 | .dac_nids = alc660vd_dac_nids, |
| 17050 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17051 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17052 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17053 | .input_mux = &alc861vd_capture_source, |
| 17054 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17055 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17056 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17057 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17058 | }; |
| 17059 | |
| 17060 | /* |
| 17061 | * BIOS auto configuration |
| 17062 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17063 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 17064 | const struct auto_pin_cfg *cfg) |
| 17065 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 17066 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17067 | } |
| 17068 | |
| 17069 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17070 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17071 | hda_nid_t nid, int pin_type, int dac_idx) |
| 17072 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17073 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17074 | } |
| 17075 | |
| 17076 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 17077 | { |
| 17078 | struct alc_spec *spec = codec->spec; |
| 17079 | int i; |
| 17080 | |
| 17081 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17082 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17083 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17084 | if (nid) |
| 17085 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17086 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17087 | } |
| 17088 | } |
| 17089 | |
| 17090 | |
| 17091 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 17092 | { |
| 17093 | struct alc_spec *spec = codec->spec; |
| 17094 | hda_nid_t pin; |
| 17095 | |
| 17096 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17097 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17098 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17099 | pin = spec->autocfg.speaker_pins[0]; |
| 17100 | if (pin) |
| 17101 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17102 | } |
| 17103 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17104 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 17105 | |
| 17106 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 17107 | { |
| 17108 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17109 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17110 | int i; |
| 17111 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17112 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17113 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17114 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17115 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17116 | if (nid != ALC861VD_PIN_CD_NID && |
| 17117 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17118 | snd_hda_codec_write(codec, nid, 0, |
| 17119 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17120 | AMP_OUT_MUTE); |
| 17121 | } |
| 17122 | } |
| 17123 | } |
| 17124 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17125 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17126 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17127 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17128 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17129 | |
| 17130 | /* add playback controls from the parsed DAC table */ |
| 17131 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17132 | * different NIDs for mute/unmute switch and volume control */ |
| 17133 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17134 | const struct auto_pin_cfg *cfg) |
| 17135 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17136 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17137 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17138 | hda_nid_t nid_v, nid_s; |
| 17139 | int i, err; |
| 17140 | |
| 17141 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17142 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17143 | continue; |
| 17144 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17145 | alc880_dac_to_idx( |
| 17146 | spec->multiout.dac_nids[i])); |
| 17147 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17148 | alc880_dac_to_idx( |
| 17149 | spec->multiout.dac_nids[i])); |
| 17150 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17151 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17152 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17153 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17154 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17155 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17156 | HDA_OUTPUT)); |
| 17157 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17158 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17159 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17160 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17161 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17162 | HDA_OUTPUT)); |
| 17163 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17164 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17165 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17166 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17167 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17168 | HDA_INPUT)); |
| 17169 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17170 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17171 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17172 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17173 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17174 | HDA_INPUT)); |
| 17175 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17176 | return err; |
| 17177 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17178 | const char *name = pfx; |
| 17179 | if (!name) |
| 17180 | name = chname[i]; |
| 17181 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17182 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17183 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17184 | HDA_OUTPUT)); |
| 17185 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17186 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17187 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17188 | name, i, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17189 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17190 | HDA_INPUT)); |
| 17191 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17192 | return err; |
| 17193 | } |
| 17194 | } |
| 17195 | return 0; |
| 17196 | } |
| 17197 | |
| 17198 | /* add playback controls for speaker and HP outputs */ |
| 17199 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17200 | * different NIDs for mute/unmute switch and volume control */ |
| 17201 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17202 | hda_nid_t pin, const char *pfx) |
| 17203 | { |
| 17204 | hda_nid_t nid_v, nid_s; |
| 17205 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17206 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17207 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17208 | return 0; |
| 17209 | |
| 17210 | if (alc880_is_fixed_pin(pin)) { |
| 17211 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17212 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17213 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17214 | spec->multiout.hp_nid = nid_v; |
| 17215 | else |
| 17216 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17217 | /* control HP volume/switch on the output mixer amp */ |
| 17218 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17219 | alc880_fixed_pin_idx(pin)); |
| 17220 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17221 | alc880_fixed_pin_idx(pin)); |
| 17222 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17223 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17224 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17225 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17226 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17227 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17228 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17229 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17230 | return err; |
| 17231 | } else if (alc880_is_multi_pin(pin)) { |
| 17232 | /* set manual connection */ |
| 17233 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17234 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17235 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17236 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17237 | return err; |
| 17238 | } |
| 17239 | return 0; |
| 17240 | } |
| 17241 | |
| 17242 | /* parse the BIOS configuration and set up the alc_spec |
| 17243 | * return 1 if successful, 0 if the proper config is not found, |
| 17244 | * or a negative error code |
| 17245 | * Based on ALC880 version - had to change it to override |
| 17246 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17247 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17248 | { |
| 17249 | struct alc_spec *spec = codec->spec; |
| 17250 | int err; |
| 17251 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17252 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17253 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17254 | alc861vd_ignore); |
| 17255 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17256 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17257 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17258 | return 0; /* can't find valid BIOS pin config */ |
| 17259 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17260 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17261 | if (err < 0) |
| 17262 | return err; |
| 17263 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17264 | if (err < 0) |
| 17265 | return err; |
| 17266 | err = alc861vd_auto_create_extra_out(spec, |
| 17267 | spec->autocfg.speaker_pins[0], |
| 17268 | "Speaker"); |
| 17269 | if (err < 0) |
| 17270 | return err; |
| 17271 | err = alc861vd_auto_create_extra_out(spec, |
| 17272 | spec->autocfg.hp_pins[0], |
| 17273 | "Headphone"); |
| 17274 | if (err < 0) |
| 17275 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17276 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17277 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17278 | return err; |
| 17279 | |
| 17280 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17281 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17282 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17283 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17284 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17285 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17286 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17287 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17288 | |
| 17289 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17290 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17291 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17292 | err = alc_auto_add_mic_boost(codec); |
| 17293 | if (err < 0) |
| 17294 | return err; |
| 17295 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17296 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17297 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17298 | return 1; |
| 17299 | } |
| 17300 | |
| 17301 | /* additional initialization for auto-configuration model */ |
| 17302 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17303 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17304 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17305 | alc861vd_auto_init_multi_out(codec); |
| 17306 | alc861vd_auto_init_hp_out(codec); |
| 17307 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17308 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17309 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17310 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17311 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17312 | } |
| 17313 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17314 | enum { |
| 17315 | ALC660VD_FIX_ASUS_GPIO1 |
| 17316 | }; |
| 17317 | |
| 17318 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17319 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17320 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17321 | .type = ALC_FIXUP_VERBS, |
| 17322 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17323 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17324 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17325 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17326 | { } |
| 17327 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17328 | }, |
| 17329 | }; |
| 17330 | |
| 17331 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17332 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17333 | {} |
| 17334 | }; |
| 17335 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17336 | static int patch_alc861vd(struct hda_codec *codec) |
| 17337 | { |
| 17338 | struct alc_spec *spec; |
| 17339 | int err, board_config; |
| 17340 | |
| 17341 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17342 | if (spec == NULL) |
| 17343 | return -ENOMEM; |
| 17344 | |
| 17345 | codec->spec = spec; |
| 17346 | |
| 17347 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17348 | alc861vd_models, |
| 17349 | alc861vd_cfg_tbl); |
| 17350 | |
| 17351 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17352 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17353 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17354 | board_config = ALC861VD_AUTO; |
| 17355 | } |
| 17356 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17357 | if (board_config == ALC861VD_AUTO) { |
| 17358 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17359 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17360 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17361 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17362 | if (board_config == ALC861VD_AUTO) { |
| 17363 | /* automatic parse from the BIOS config */ |
| 17364 | err = alc861vd_parse_auto_config(codec); |
| 17365 | if (err < 0) { |
| 17366 | alc_free(codec); |
| 17367 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17368 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17369 | printk(KERN_INFO |
| 17370 | "hda_codec: Cannot set up configuration " |
| 17371 | "from BIOS. Using base mode...\n"); |
| 17372 | board_config = ALC861VD_3ST; |
| 17373 | } |
| 17374 | } |
| 17375 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17376 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17377 | if (err < 0) { |
| 17378 | alc_free(codec); |
| 17379 | return err; |
| 17380 | } |
| 17381 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17382 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17383 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17384 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17385 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17386 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17387 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17388 | } |
| 17389 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17390 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17391 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17392 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17393 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17394 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17395 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17396 | if (!spec->adc_nids) { |
| 17397 | spec->adc_nids = alc861vd_adc_nids; |
| 17398 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17399 | } |
| 17400 | if (!spec->capsrc_nids) |
| 17401 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17402 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17403 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17404 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17405 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17406 | spec->vmaster_nid = 0x02; |
| 17407 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17408 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17409 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17410 | codec->patch_ops = alc_patch_ops; |
| 17411 | |
| 17412 | if (board_config == ALC861VD_AUTO) |
| 17413 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17414 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17415 | if (!spec->loopback.amplist) |
| 17416 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17417 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17418 | |
| 17419 | return 0; |
| 17420 | } |
| 17421 | |
| 17422 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17423 | * ALC662 support |
| 17424 | * |
| 17425 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17426 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17427 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17428 | * 6-channel independent captures. |
| 17429 | * |
| 17430 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17431 | * driver yet). |
| 17432 | */ |
| 17433 | #define ALC662_DIGOUT_NID 0x06 |
| 17434 | #define ALC662_DIGIN_NID 0x0a |
| 17435 | |
| 17436 | static hda_nid_t alc662_dac_nids[4] = { |
| 17437 | /* front, rear, clfe, rear_surr */ |
| 17438 | 0x02, 0x03, 0x04 |
| 17439 | }; |
| 17440 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17441 | static hda_nid_t alc272_dac_nids[2] = { |
| 17442 | 0x02, 0x03 |
| 17443 | }; |
| 17444 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17445 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17446 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17447 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17448 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17449 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17450 | static hda_nid_t alc272_adc_nids[1] = { |
| 17451 | /* ADC1-2 */ |
| 17452 | 0x08, |
| 17453 | }; |
| 17454 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17455 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17456 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17457 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17458 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17459 | /* input MUX */ |
| 17460 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17461 | static struct hda_input_mux alc662_capture_source = { |
| 17462 | .num_items = 4, |
| 17463 | .items = { |
| 17464 | { "Mic", 0x0 }, |
| 17465 | { "Front Mic", 0x1 }, |
| 17466 | { "Line", 0x2 }, |
| 17467 | { "CD", 0x4 }, |
| 17468 | }, |
| 17469 | }; |
| 17470 | |
| 17471 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17472 | .num_items = 2, |
| 17473 | .items = { |
| 17474 | { "Mic", 0x1 }, |
| 17475 | { "Line", 0x2 }, |
| 17476 | }, |
| 17477 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17478 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17479 | static struct hda_input_mux alc663_capture_source = { |
| 17480 | .num_items = 3, |
| 17481 | .items = { |
| 17482 | { "Mic", 0x0 }, |
| 17483 | { "Front Mic", 0x1 }, |
| 17484 | { "Line", 0x2 }, |
| 17485 | }, |
| 17486 | }; |
| 17487 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17488 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17489 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17490 | .num_items = 16, |
| 17491 | .items = { |
| 17492 | { "Autoselect Mic", 0x0 }, |
| 17493 | { "Internal Mic", 0x1 }, |
| 17494 | { "In-0x02", 0x2 }, |
| 17495 | { "In-0x03", 0x3 }, |
| 17496 | { "In-0x04", 0x4 }, |
| 17497 | { "In-0x05", 0x5 }, |
| 17498 | { "In-0x06", 0x6 }, |
| 17499 | { "In-0x07", 0x7 }, |
| 17500 | { "In-0x08", 0x8 }, |
| 17501 | { "In-0x09", 0x9 }, |
| 17502 | { "In-0x0a", 0x0a }, |
| 17503 | { "In-0x0b", 0x0b }, |
| 17504 | { "In-0x0c", 0x0c }, |
| 17505 | { "In-0x0d", 0x0d }, |
| 17506 | { "In-0x0e", 0x0e }, |
| 17507 | { "In-0x0f", 0x0f }, |
| 17508 | }, |
| 17509 | }; |
| 17510 | #endif |
| 17511 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17512 | /* |
| 17513 | * 2ch mode |
| 17514 | */ |
| 17515 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17516 | { 2, NULL } |
| 17517 | }; |
| 17518 | |
| 17519 | /* |
| 17520 | * 2ch mode |
| 17521 | */ |
| 17522 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17523 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17524 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17525 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17526 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17527 | { } /* end */ |
| 17528 | }; |
| 17529 | |
| 17530 | /* |
| 17531 | * 6ch mode |
| 17532 | */ |
| 17533 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17534 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17535 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17536 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17537 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17538 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17539 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17540 | { } /* end */ |
| 17541 | }; |
| 17542 | |
| 17543 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17544 | { 2, alc662_3ST_ch2_init }, |
| 17545 | { 6, alc662_3ST_ch6_init }, |
| 17546 | }; |
| 17547 | |
| 17548 | /* |
| 17549 | * 2ch mode |
| 17550 | */ |
| 17551 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17552 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17553 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17554 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17555 | { } /* end */ |
| 17556 | }; |
| 17557 | |
| 17558 | /* |
| 17559 | * 6ch mode |
| 17560 | */ |
| 17561 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17562 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17563 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17564 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17565 | { } /* end */ |
| 17566 | }; |
| 17567 | |
| 17568 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17569 | { 2, alc662_sixstack_ch6_init }, |
| 17570 | { 6, alc662_sixstack_ch8_init }, |
| 17571 | }; |
| 17572 | |
| 17573 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17574 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17575 | */ |
| 17576 | |
| 17577 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17578 | /* output mixer control */ |
| 17579 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17580 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17581 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17582 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17583 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17584 | 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] | 17585 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17586 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17587 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17588 | |
| 17589 | /*Input mixer control */ |
| 17590 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17591 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17592 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17593 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17595 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17596 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17597 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17598 | { } /* end */ |
| 17599 | }; |
| 17600 | |
| 17601 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17602 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17603 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17604 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17605 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17606 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17607 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17608 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17609 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17610 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17611 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17612 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17613 | { } /* end */ |
| 17614 | }; |
| 17615 | |
| 17616 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17617 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17618 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17619 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17620 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17621 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17622 | 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] | 17623 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17624 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17625 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17626 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17627 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17628 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17629 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17630 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17631 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17632 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17633 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17634 | { } /* end */ |
| 17635 | }; |
| 17636 | |
| 17637 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17638 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17639 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17640 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17641 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17642 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17643 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17644 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17645 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17646 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17647 | { } /* end */ |
| 17648 | }; |
| 17649 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17650 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17651 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17652 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17653 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17654 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17655 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17656 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17657 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17658 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17659 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17660 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17661 | { } /* end */ |
| 17662 | }; |
| 17663 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17664 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17665 | ALC262_HIPPO_MASTER_SWITCH, |
| 17666 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17667 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17668 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17669 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17670 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17671 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17672 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17673 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17674 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17675 | { } /* end */ |
| 17676 | }; |
| 17677 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17678 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17679 | .ops = &snd_hda_bind_vol, |
| 17680 | .values = { |
| 17681 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17682 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17683 | 0 |
| 17684 | }, |
| 17685 | }; |
| 17686 | |
| 17687 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17688 | .ops = &snd_hda_bind_sw, |
| 17689 | .values = { |
| 17690 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17691 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17692 | 0 |
| 17693 | }, |
| 17694 | }; |
| 17695 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17696 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17697 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17698 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17699 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17700 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17701 | { } /* end */ |
| 17702 | }; |
| 17703 | |
| 17704 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17705 | .ops = &snd_hda_bind_sw, |
| 17706 | .values = { |
| 17707 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17708 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17709 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17710 | 0 |
| 17711 | }, |
| 17712 | }; |
| 17713 | |
| 17714 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17715 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17716 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17717 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17718 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17719 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17720 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17721 | |
| 17722 | { } /* end */ |
| 17723 | }; |
| 17724 | |
| 17725 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17726 | .ops = &snd_hda_bind_sw, |
| 17727 | .values = { |
| 17728 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17729 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17730 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17731 | 0 |
| 17732 | }, |
| 17733 | }; |
| 17734 | |
| 17735 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17736 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17737 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17738 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17739 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17740 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17741 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17742 | { } /* end */ |
| 17743 | }; |
| 17744 | |
| 17745 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17746 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17747 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17748 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17749 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17750 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17751 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17752 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17753 | { } /* end */ |
| 17754 | }; |
| 17755 | |
| 17756 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17757 | .ops = &snd_hda_bind_vol, |
| 17758 | .values = { |
| 17759 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17760 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17761 | 0 |
| 17762 | }, |
| 17763 | }; |
| 17764 | |
| 17765 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17766 | .ops = &snd_hda_bind_sw, |
| 17767 | .values = { |
| 17768 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17769 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17770 | 0 |
| 17771 | }, |
| 17772 | }; |
| 17773 | |
| 17774 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17775 | HDA_BIND_VOL("Master Playback Volume", |
| 17776 | &alc663_asus_two_bind_master_vol), |
| 17777 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17778 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17779 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 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), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17782 | { } /* end */ |
| 17783 | }; |
| 17784 | |
| 17785 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17786 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17787 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17788 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17789 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17790 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17791 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17792 | { } /* end */ |
| 17793 | }; |
| 17794 | |
| 17795 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17796 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17797 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17798 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17799 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17800 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17801 | |
| 17802 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17803 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17804 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17805 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17806 | { } /* end */ |
| 17807 | }; |
| 17808 | |
| 17809 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17810 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17811 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17812 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17813 | |
| 17814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17816 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17817 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17818 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17819 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17820 | { } /* end */ |
| 17821 | }; |
| 17822 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17823 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17824 | .ops = &snd_hda_bind_sw, |
| 17825 | .values = { |
| 17826 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17827 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17828 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17829 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17830 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17831 | 0 |
| 17832 | }, |
| 17833 | }; |
| 17834 | |
| 17835 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17836 | .ops = &snd_hda_bind_sw, |
| 17837 | .values = { |
| 17838 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17839 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17840 | 0 |
| 17841 | }, |
| 17842 | }; |
| 17843 | |
| 17844 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17845 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17846 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17847 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17848 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17849 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17850 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17851 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17853 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17854 | { } /* end */ |
| 17855 | }; |
| 17856 | |
| 17857 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17858 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17859 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17860 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17861 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17862 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17863 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17864 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17865 | { } /* end */ |
| 17866 | }; |
| 17867 | |
| 17868 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17869 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17870 | { |
| 17871 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17872 | .name = "Channel Mode", |
| 17873 | .info = alc_ch_mode_info, |
| 17874 | .get = alc_ch_mode_get, |
| 17875 | .put = alc_ch_mode_put, |
| 17876 | }, |
| 17877 | { } /* end */ |
| 17878 | }; |
| 17879 | |
| 17880 | static struct hda_verb alc662_init_verbs[] = { |
| 17881 | /* ADC: mute amp left and right */ |
| 17882 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17883 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17884 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17886 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17887 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17888 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17889 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17890 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17891 | |
| 17892 | /* Front Pin: output 0 (0x0c) */ |
| 17893 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17894 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17895 | |
| 17896 | /* Rear Pin: output 1 (0x0d) */ |
| 17897 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17898 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17899 | |
| 17900 | /* CLFE Pin: output 2 (0x0e) */ |
| 17901 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17902 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17903 | |
| 17904 | /* Mic (rear) pin: input vref at 80% */ |
| 17905 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17906 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17907 | /* Front Mic pin: input vref at 80% */ |
| 17908 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17909 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17910 | /* Line In pin: input */ |
| 17911 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17912 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17913 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17914 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17915 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17916 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17917 | /* CD pin widget for input */ |
| 17918 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17919 | |
| 17920 | /* FIXME: use matrix-type input source selection */ |
| 17921 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17922 | /* Input mixer */ |
| 17923 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17924 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17925 | |
| 17926 | /* always trun on EAPD */ |
| 17927 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17928 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17929 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17930 | { } |
| 17931 | }; |
| 17932 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17933 | static struct hda_verb alc663_init_verbs[] = { |
| 17934 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17935 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17936 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17937 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17938 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17939 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17940 | { } |
| 17941 | }; |
| 17942 | |
| 17943 | static struct hda_verb alc272_init_verbs[] = { |
| 17944 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17945 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17946 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17947 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17948 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17949 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17950 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17951 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17952 | { } |
| 17953 | }; |
| 17954 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17955 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17956 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17957 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17958 | {} |
| 17959 | }; |
| 17960 | |
| 17961 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17962 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17963 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17964 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17965 | }; |
| 17966 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17967 | /* Set Unsolicited Event*/ |
| 17968 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17969 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17970 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17971 | {} |
| 17972 | }; |
| 17973 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17974 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17975 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17976 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17977 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17978 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17979 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17980 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17981 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17982 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17983 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17984 | {} |
| 17985 | }; |
| 17986 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17987 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17988 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17989 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17990 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17991 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17992 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17993 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17994 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17995 | {} |
| 17996 | }; |
| 17997 | |
| 17998 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17999 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18000 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18001 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18002 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18003 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18004 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18005 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18006 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18007 | {} |
| 18008 | }; |
| 18009 | |
| 18010 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 18011 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18012 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18013 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18014 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18015 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18016 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18017 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18018 | {} |
| 18019 | }; |
| 18020 | |
| 18021 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 18022 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18023 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18024 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18025 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18026 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18028 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18029 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18030 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18031 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18032 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18033 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18034 | {} |
| 18035 | }; |
| 18036 | |
| 18037 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 18038 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18039 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18040 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18041 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 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 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18049 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18050 | {} |
| 18051 | }; |
| 18052 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18053 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 18054 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18055 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 18056 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 18057 | |
| 18058 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18059 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18060 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18061 | |
| 18062 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 18063 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 18064 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 18065 | {} |
| 18066 | }; |
| 18067 | |
| 18068 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 18069 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18070 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18071 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18072 | |
| 18073 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18074 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18075 | {} |
| 18076 | }; |
| 18077 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18078 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 18079 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 18080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18081 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18082 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18083 | {} |
| 18084 | }; |
| 18085 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18086 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 18087 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18088 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18089 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18090 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18091 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18092 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18093 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18094 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18095 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18096 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18097 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18098 | {} |
| 18099 | }; |
| 18100 | |
| 18101 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 18102 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18103 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18104 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18105 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18106 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18107 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18108 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18109 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18110 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18111 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18112 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18113 | {} |
| 18114 | }; |
| 18115 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18116 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 18117 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18118 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18119 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18120 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18121 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18122 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18123 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18124 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18125 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18126 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18127 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18128 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18129 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18130 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18131 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18132 | {} |
| 18133 | }; |
| 18134 | |
| 18135 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 18136 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18137 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18138 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18139 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18140 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18141 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18142 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18143 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18144 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18145 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18146 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18147 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18148 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18149 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18150 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18151 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18152 | {} |
| 18153 | }; |
| 18154 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18155 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18156 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18157 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18158 | { } /* end */ |
| 18159 | }; |
| 18160 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18161 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18162 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18163 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18164 | { } /* end */ |
| 18165 | }; |
| 18166 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18167 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 18168 | { |
| 18169 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18170 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18171 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18172 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18173 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18174 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18175 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18176 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18177 | } |
| 18178 | |
| 18179 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 18180 | { |
| 18181 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18182 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18183 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18184 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18185 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18186 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18187 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18188 | HDA_AMP_MUTE, bits); |
| 18189 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18190 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18191 | } |
| 18192 | |
| 18193 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 18194 | unsigned int res) |
| 18195 | { |
| 18196 | if ((res >> 26) == ALC880_HP_EVENT) |
| 18197 | alc662_lenovo_101e_all_automute(codec); |
| 18198 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 18199 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 18200 | } |
| 18201 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18202 | /* unsolicited event for HP jack sensing */ |
| 18203 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 18204 | unsigned int res) |
| 18205 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18206 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18207 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18208 | else |
| 18209 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18210 | } |
| 18211 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18212 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18213 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18214 | struct alc_spec *spec = codec->spec; |
| 18215 | |
| 18216 | alc262_hippo1_setup(codec); |
| 18217 | spec->ext_mic.pin = 0x18; |
| 18218 | spec->ext_mic.mux_idx = 0; |
| 18219 | spec->int_mic.pin = 0x19; |
| 18220 | spec->int_mic.mux_idx = 1; |
| 18221 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18222 | } |
| 18223 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18224 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 18225 | { |
| 18226 | alc262_hippo_automute(codec); |
| 18227 | alc_mic_automute(codec); |
| 18228 | } |
| 18229 | |
| 18230 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18231 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18232 | struct alc_spec *spec = codec->spec; |
| 18233 | |
| 18234 | spec->autocfg.hp_pins[0] = 0x14; |
| 18235 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18236 | } |
| 18237 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18238 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 18239 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18240 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 18241 | { |
| 18242 | unsigned int present; |
| 18243 | unsigned char bits; |
| 18244 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18245 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18246 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18247 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18248 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18249 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18250 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18251 | } |
| 18252 | |
| 18253 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 18254 | { |
| 18255 | unsigned int present; |
| 18256 | unsigned char bits; |
| 18257 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18258 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18259 | bits = present ? HDA_AMP_MUTE : 0; |
| 18260 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18261 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18262 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18263 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18264 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18265 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18266 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18267 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18268 | } |
| 18269 | |
| 18270 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18271 | { |
| 18272 | unsigned int present; |
| 18273 | unsigned char bits; |
| 18274 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18275 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18276 | bits = present ? HDA_AMP_MUTE : 0; |
| 18277 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18278 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18279 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18280 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18281 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18282 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18283 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18284 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18285 | } |
| 18286 | |
| 18287 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18288 | { |
| 18289 | unsigned int present; |
| 18290 | unsigned char bits; |
| 18291 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18292 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18293 | bits = present ? 0 : PIN_OUT; |
| 18294 | snd_hda_codec_write(codec, 0x14, 0, |
| 18295 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18296 | } |
| 18297 | |
| 18298 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18299 | { |
| 18300 | unsigned int present1, present2; |
| 18301 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18302 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18303 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18304 | |
| 18305 | if (present1 || present2) { |
| 18306 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18307 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18308 | } else { |
| 18309 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18310 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18311 | } |
| 18312 | } |
| 18313 | |
| 18314 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18315 | { |
| 18316 | unsigned int present1, present2; |
| 18317 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18318 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18319 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18320 | |
| 18321 | if (present1 || present2) { |
| 18322 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18323 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18324 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18325 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18326 | } else { |
| 18327 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18328 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18329 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18330 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18331 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18332 | } |
| 18333 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18334 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18335 | { |
| 18336 | unsigned int present1, present2; |
| 18337 | |
| 18338 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18339 | AC_VERB_GET_PIN_SENSE, 0) |
| 18340 | & AC_PINSENSE_PRESENCE; |
| 18341 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18342 | AC_VERB_GET_PIN_SENSE, 0) |
| 18343 | & AC_PINSENSE_PRESENCE; |
| 18344 | |
| 18345 | if (present1 || present2) { |
| 18346 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18347 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18348 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18349 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18350 | } else { |
| 18351 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18352 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18353 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18354 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18355 | } |
| 18356 | } |
| 18357 | |
| 18358 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18359 | { |
| 18360 | unsigned int present1, present2; |
| 18361 | |
| 18362 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18363 | AC_VERB_GET_PIN_SENSE, 0) |
| 18364 | & AC_PINSENSE_PRESENCE; |
| 18365 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18366 | AC_VERB_GET_PIN_SENSE, 0) |
| 18367 | & AC_PINSENSE_PRESENCE; |
| 18368 | |
| 18369 | if (present1 || present2) { |
| 18370 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18371 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18372 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18373 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18374 | } else { |
| 18375 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18376 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18377 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18378 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18379 | } |
| 18380 | } |
| 18381 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18382 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18383 | unsigned int res) |
| 18384 | { |
| 18385 | switch (res >> 26) { |
| 18386 | case ALC880_HP_EVENT: |
| 18387 | alc663_m51va_speaker_automute(codec); |
| 18388 | break; |
| 18389 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18390 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18391 | break; |
| 18392 | } |
| 18393 | } |
| 18394 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18395 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18396 | { |
| 18397 | struct alc_spec *spec = codec->spec; |
| 18398 | spec->ext_mic.pin = 0x18; |
| 18399 | spec->ext_mic.mux_idx = 0; |
| 18400 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18401 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18402 | spec->auto_mic = 1; |
| 18403 | } |
| 18404 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18405 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18406 | { |
| 18407 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18408 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18409 | } |
| 18410 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18411 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18412 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18413 | |
| 18414 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18415 | { |
| 18416 | struct alc_spec *spec = codec->spec; |
| 18417 | spec->ext_mic.pin = 0x18; |
| 18418 | spec->ext_mic.mux_idx = 0; |
| 18419 | spec->int_mic.pin = 0x19; |
| 18420 | spec->int_mic.mux_idx = 1; |
| 18421 | spec->auto_mic = 1; |
| 18422 | } |
| 18423 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18424 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18425 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18426 | /* ***************** Mode2 ******************************/ |
| 18427 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18428 | unsigned int res) |
| 18429 | { |
| 18430 | switch (res >> 26) { |
| 18431 | case ALC880_HP_EVENT: |
| 18432 | alc662_f5z_speaker_automute(codec); |
| 18433 | break; |
| 18434 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18435 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18436 | break; |
| 18437 | } |
| 18438 | } |
| 18439 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18440 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18441 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18442 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18443 | { |
| 18444 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18445 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18446 | } |
| 18447 | /* ***************** Mode3 ******************************/ |
| 18448 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18449 | unsigned int res) |
| 18450 | { |
| 18451 | switch (res >> 26) { |
| 18452 | case ALC880_HP_EVENT: |
| 18453 | alc663_two_hp_m1_speaker_automute(codec); |
| 18454 | break; |
| 18455 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18456 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18457 | break; |
| 18458 | } |
| 18459 | } |
| 18460 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18461 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18462 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18463 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18464 | { |
| 18465 | alc663_two_hp_m1_speaker_automute(codec); |
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 | } |
| 18468 | /* ***************** Mode4 ******************************/ |
| 18469 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18470 | unsigned int res) |
| 18471 | { |
| 18472 | switch (res >> 26) { |
| 18473 | case ALC880_HP_EVENT: |
| 18474 | alc663_21jd_two_speaker_automute(codec); |
| 18475 | break; |
| 18476 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18477 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18478 | break; |
| 18479 | } |
| 18480 | } |
| 18481 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18482 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18483 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18484 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18485 | { |
| 18486 | alc663_21jd_two_speaker_automute(codec); |
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 | } |
| 18489 | /* ***************** Mode5 ******************************/ |
| 18490 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18491 | unsigned int res) |
| 18492 | { |
| 18493 | switch (res >> 26) { |
| 18494 | case ALC880_HP_EVENT: |
| 18495 | alc663_15jd_two_speaker_automute(codec); |
| 18496 | break; |
| 18497 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18498 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18499 | break; |
| 18500 | } |
| 18501 | } |
| 18502 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18503 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18504 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18505 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18506 | { |
| 18507 | alc663_15jd_two_speaker_automute(codec); |
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 | } |
| 18510 | /* ***************** Mode6 ******************************/ |
| 18511 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18512 | unsigned int res) |
| 18513 | { |
| 18514 | switch (res >> 26) { |
| 18515 | case ALC880_HP_EVENT: |
| 18516 | alc663_two_hp_m2_speaker_automute(codec); |
| 18517 | break; |
| 18518 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18519 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18520 | break; |
| 18521 | } |
| 18522 | } |
| 18523 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18524 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18525 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18526 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18527 | { |
| 18528 | alc663_two_hp_m2_speaker_automute(codec); |
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 | } |
| 18531 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18532 | /* ***************** Mode7 ******************************/ |
| 18533 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18534 | unsigned int res) |
| 18535 | { |
| 18536 | switch (res >> 26) { |
| 18537 | case ALC880_HP_EVENT: |
| 18538 | alc663_two_hp_m7_speaker_automute(codec); |
| 18539 | break; |
| 18540 | case ALC880_MIC_EVENT: |
| 18541 | alc_mic_automute(codec); |
| 18542 | break; |
| 18543 | } |
| 18544 | } |
| 18545 | |
| 18546 | #define alc663_mode7_setup alc663_mode1_setup |
| 18547 | |
| 18548 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18549 | { |
| 18550 | alc663_two_hp_m7_speaker_automute(codec); |
| 18551 | alc_mic_automute(codec); |
| 18552 | } |
| 18553 | |
| 18554 | /* ***************** Mode8 ******************************/ |
| 18555 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18556 | unsigned int res) |
| 18557 | { |
| 18558 | switch (res >> 26) { |
| 18559 | case ALC880_HP_EVENT: |
| 18560 | alc663_two_hp_m8_speaker_automute(codec); |
| 18561 | break; |
| 18562 | case ALC880_MIC_EVENT: |
| 18563 | alc_mic_automute(codec); |
| 18564 | break; |
| 18565 | } |
| 18566 | } |
| 18567 | |
| 18568 | #define alc663_mode8_setup alc663_m51va_setup |
| 18569 | |
| 18570 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18571 | { |
| 18572 | alc663_two_hp_m8_speaker_automute(codec); |
| 18573 | alc_mic_automute(codec); |
| 18574 | } |
| 18575 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18576 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18577 | { |
| 18578 | unsigned int present; |
| 18579 | unsigned char bits; |
| 18580 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18581 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18582 | bits = present ? HDA_AMP_MUTE : 0; |
| 18583 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18584 | HDA_AMP_MUTE, bits); |
| 18585 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18586 | HDA_AMP_MUTE, bits); |
| 18587 | } |
| 18588 | |
| 18589 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18590 | { |
| 18591 | unsigned int present; |
| 18592 | unsigned char bits; |
| 18593 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18594 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18595 | bits = present ? HDA_AMP_MUTE : 0; |
| 18596 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18597 | HDA_AMP_MUTE, bits); |
| 18598 | } |
| 18599 | |
| 18600 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18601 | unsigned int res) |
| 18602 | { |
| 18603 | switch (res >> 26) { |
| 18604 | case ALC880_HP_EVENT: |
| 18605 | alc663_g71v_hp_automute(codec); |
| 18606 | break; |
| 18607 | case ALC880_FRONT_EVENT: |
| 18608 | alc663_g71v_front_automute(codec); |
| 18609 | break; |
| 18610 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18611 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18612 | break; |
| 18613 | } |
| 18614 | } |
| 18615 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18616 | #define alc663_g71v_setup alc663_m51va_setup |
| 18617 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18618 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18619 | { |
| 18620 | alc663_g71v_front_automute(codec); |
| 18621 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18622 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18623 | } |
| 18624 | |
| 18625 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18626 | unsigned int res) |
| 18627 | { |
| 18628 | switch (res >> 26) { |
| 18629 | case ALC880_HP_EVENT: |
| 18630 | alc663_m51va_speaker_automute(codec); |
| 18631 | break; |
| 18632 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18633 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18634 | break; |
| 18635 | } |
| 18636 | } |
| 18637 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18638 | #define alc663_g50v_setup alc663_m51va_setup |
| 18639 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18640 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18641 | { |
| 18642 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18643 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18644 | } |
| 18645 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18646 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18647 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18648 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18649 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18650 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18651 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18652 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18653 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18654 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18655 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18656 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18657 | { } /* end */ |
| 18658 | }; |
| 18659 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18660 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18661 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18662 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18663 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18664 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18665 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18666 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18669 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18670 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18671 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18672 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18673 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18674 | { } /* end */ |
| 18675 | }; |
| 18676 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18677 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18678 | #define alc662_loopbacks alc880_loopbacks |
| 18679 | #endif |
| 18680 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18681 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18682 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18683 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18684 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18685 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18686 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18687 | |
| 18688 | /* |
| 18689 | * configuration and preset |
| 18690 | */ |
| 18691 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18692 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18693 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18694 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18695 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18696 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18697 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18698 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18699 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18700 | [ALC663_ASUS_M51VA] = "m51va", |
| 18701 | [ALC663_ASUS_G71V] = "g71v", |
| 18702 | [ALC663_ASUS_H13] = "h13", |
| 18703 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18704 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18705 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18706 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18707 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18708 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18709 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18710 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18711 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18712 | [ALC272_DELL] = "dell", |
| 18713 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18714 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18715 | [ALC662_AUTO] = "auto", |
| 18716 | }; |
| 18717 | |
| 18718 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18719 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18720 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18721 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18722 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18723 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18724 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18725 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18726 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18727 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18728 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18729 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18730 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18731 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18732 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18733 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18734 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18735 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18736 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18737 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18738 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18739 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18740 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18741 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18742 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18743 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18744 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18745 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18746 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18747 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18748 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18749 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18750 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18751 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18752 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18753 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18754 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18755 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18756 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18757 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18758 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18759 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18760 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18761 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18762 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18763 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18764 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18765 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18766 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18767 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18768 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18769 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18770 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18771 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18772 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18773 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18774 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18775 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18776 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18777 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18778 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18779 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18780 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18781 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18782 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18783 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18784 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18785 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18786 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18787 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18788 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18789 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18790 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18791 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18792 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18793 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18794 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18795 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18796 | {} |
| 18797 | }; |
| 18798 | |
| 18799 | static struct alc_config_preset alc662_presets[] = { |
| 18800 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18801 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18802 | .init_verbs = { alc662_init_verbs }, |
| 18803 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18804 | .dac_nids = alc662_dac_nids, |
| 18805 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18806 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18807 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18808 | .channel_mode = alc662_3ST_2ch_modes, |
| 18809 | .input_mux = &alc662_capture_source, |
| 18810 | }, |
| 18811 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18812 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18813 | .init_verbs = { alc662_init_verbs }, |
| 18814 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18815 | .dac_nids = alc662_dac_nids, |
| 18816 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18817 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18818 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18819 | .channel_mode = alc662_3ST_6ch_modes, |
| 18820 | .need_dac_fix = 1, |
| 18821 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18822 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18823 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18824 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18825 | .init_verbs = { alc662_init_verbs }, |
| 18826 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18827 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18828 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18829 | .channel_mode = alc662_3ST_6ch_modes, |
| 18830 | .need_dac_fix = 1, |
| 18831 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18832 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18833 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18834 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18835 | .init_verbs = { alc662_init_verbs }, |
| 18836 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18837 | .dac_nids = alc662_dac_nids, |
| 18838 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18839 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18840 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18841 | .channel_mode = alc662_5stack_modes, |
| 18842 | .input_mux = &alc662_capture_source, |
| 18843 | }, |
| 18844 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18845 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18846 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18847 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18848 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18849 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18850 | .channel_mode = alc662_3ST_2ch_modes, |
| 18851 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18852 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18853 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18854 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18855 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18856 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18857 | .init_verbs = { alc662_init_verbs, |
| 18858 | alc662_eeepc_sue_init_verbs }, |
| 18859 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18860 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18861 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18862 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18863 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18864 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18865 | .init_hook = alc662_eeepc_inithook, |
| 18866 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18867 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18868 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18869 | alc662_chmode_mixer }, |
| 18870 | .init_verbs = { alc662_init_verbs, |
| 18871 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18872 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18873 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18874 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18875 | .channel_mode = alc662_3ST_6ch_modes, |
| 18876 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18877 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18878 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18879 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18880 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18881 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18882 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18883 | .init_verbs = { alc662_init_verbs, |
| 18884 | alc662_ecs_init_verbs }, |
| 18885 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18886 | .dac_nids = alc662_dac_nids, |
| 18887 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18888 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18889 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18890 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18891 | .init_hook = alc662_eeepc_inithook, |
| 18892 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18893 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18894 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18895 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18896 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18897 | .dac_nids = alc662_dac_nids, |
| 18898 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18899 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18900 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18901 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18902 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18903 | .init_hook = alc663_m51va_inithook, |
| 18904 | }, |
| 18905 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18906 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18907 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18908 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18909 | .dac_nids = alc662_dac_nids, |
| 18910 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18911 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18912 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18913 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18914 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18915 | .init_hook = alc663_g71v_inithook, |
| 18916 | }, |
| 18917 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18918 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18919 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18920 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18921 | .dac_nids = alc662_dac_nids, |
| 18922 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18923 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18924 | .unsol_event = alc663_m51va_unsol_event, |
| 18925 | .init_hook = alc663_m51va_inithook, |
| 18926 | }, |
| 18927 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18928 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18929 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18930 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18931 | .dac_nids = alc662_dac_nids, |
| 18932 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18933 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18934 | .channel_mode = alc662_3ST_6ch_modes, |
| 18935 | .input_mux = &alc663_capture_source, |
| 18936 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18937 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18938 | .init_hook = alc663_g50v_inithook, |
| 18939 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18940 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18941 | .mixers = { alc663_m51va_mixer }, |
| 18942 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18943 | .init_verbs = { alc662_init_verbs, |
| 18944 | alc663_21jd_amic_init_verbs }, |
| 18945 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18946 | .hp_nid = 0x03, |
| 18947 | .dac_nids = alc662_dac_nids, |
| 18948 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18949 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18950 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18951 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18952 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18953 | .init_hook = alc663_mode1_inithook, |
| 18954 | }, |
| 18955 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18956 | .mixers = { alc662_1bjd_mixer }, |
| 18957 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18958 | .init_verbs = { alc662_init_verbs, |
| 18959 | alc662_1bjd_amic_init_verbs }, |
| 18960 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18961 | .dac_nids = alc662_dac_nids, |
| 18962 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18963 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18964 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18965 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18966 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18967 | .init_hook = alc662_mode2_inithook, |
| 18968 | }, |
| 18969 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18970 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18971 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18972 | .init_verbs = { alc662_init_verbs, |
| 18973 | alc663_two_hp_amic_m1_init_verbs }, |
| 18974 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18975 | .hp_nid = 0x03, |
| 18976 | .dac_nids = alc662_dac_nids, |
| 18977 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18978 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18979 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18980 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18981 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18982 | .init_hook = alc663_mode3_inithook, |
| 18983 | }, |
| 18984 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18985 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18986 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18987 | .init_verbs = { alc662_init_verbs, |
| 18988 | alc663_21jd_amic_init_verbs}, |
| 18989 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18990 | .hp_nid = 0x03, |
| 18991 | .dac_nids = alc662_dac_nids, |
| 18992 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18993 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18994 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18995 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18996 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18997 | .init_hook = alc663_mode4_inithook, |
| 18998 | }, |
| 18999 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19000 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 19001 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19002 | .init_verbs = { alc662_init_verbs, |
| 19003 | alc663_15jd_amic_init_verbs }, |
| 19004 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19005 | .hp_nid = 0x03, |
| 19006 | .dac_nids = alc662_dac_nids, |
| 19007 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19008 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19009 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19010 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19011 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19012 | .init_hook = alc663_mode5_inithook, |
| 19013 | }, |
| 19014 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19015 | .mixers = { alc663_two_hp_m2_mixer }, |
| 19016 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19017 | .init_verbs = { alc662_init_verbs, |
| 19018 | alc663_two_hp_amic_m2_init_verbs }, |
| 19019 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19020 | .hp_nid = 0x03, |
| 19021 | .dac_nids = alc662_dac_nids, |
| 19022 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19023 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19024 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19025 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19026 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19027 | .init_hook = alc663_mode6_inithook, |
| 19028 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19029 | [ALC663_ASUS_MODE7] = { |
| 19030 | .mixers = { alc663_mode7_mixer }, |
| 19031 | .cap_mixer = alc662_auto_capture_mixer, |
| 19032 | .init_verbs = { alc662_init_verbs, |
| 19033 | alc663_mode7_init_verbs }, |
| 19034 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19035 | .hp_nid = 0x03, |
| 19036 | .dac_nids = alc662_dac_nids, |
| 19037 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19038 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19039 | .channel_mode = alc662_3ST_2ch_modes, |
| 19040 | .unsol_event = alc663_mode7_unsol_event, |
| 19041 | .setup = alc663_mode7_setup, |
| 19042 | .init_hook = alc663_mode7_inithook, |
| 19043 | }, |
| 19044 | [ALC663_ASUS_MODE8] = { |
| 19045 | .mixers = { alc663_mode8_mixer }, |
| 19046 | .cap_mixer = alc662_auto_capture_mixer, |
| 19047 | .init_verbs = { alc662_init_verbs, |
| 19048 | alc663_mode8_init_verbs }, |
| 19049 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19050 | .hp_nid = 0x03, |
| 19051 | .dac_nids = alc662_dac_nids, |
| 19052 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19053 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19054 | .channel_mode = alc662_3ST_2ch_modes, |
| 19055 | .unsol_event = alc663_mode8_unsol_event, |
| 19056 | .setup = alc663_mode8_setup, |
| 19057 | .init_hook = alc663_mode8_inithook, |
| 19058 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19059 | [ALC272_DELL] = { |
| 19060 | .mixers = { alc663_m51va_mixer }, |
| 19061 | .cap_mixer = alc272_auto_capture_mixer, |
| 19062 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 19063 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19064 | .dac_nids = alc662_dac_nids, |
| 19065 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19066 | .adc_nids = alc272_adc_nids, |
| 19067 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 19068 | .capsrc_nids = alc272_capsrc_nids, |
| 19069 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19070 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19071 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19072 | .init_hook = alc663_m51va_inithook, |
| 19073 | }, |
| 19074 | [ALC272_DELL_ZM1] = { |
| 19075 | .mixers = { alc663_m51va_mixer }, |
| 19076 | .cap_mixer = alc662_auto_capture_mixer, |
| 19077 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 19078 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19079 | .dac_nids = alc662_dac_nids, |
| 19080 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19081 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19082 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19083 | .capsrc_nids = alc662_capsrc_nids, |
| 19084 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19085 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19086 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19087 | .init_hook = alc663_m51va_inithook, |
| 19088 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19089 | [ALC272_SAMSUNG_NC10] = { |
| 19090 | .mixers = { alc272_nc10_mixer }, |
| 19091 | .init_verbs = { alc662_init_verbs, |
| 19092 | alc663_21jd_amic_init_verbs }, |
| 19093 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19094 | .dac_nids = alc272_dac_nids, |
| 19095 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19096 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19097 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19098 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19099 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19100 | .init_hook = alc663_mode4_inithook, |
| 19101 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19102 | }; |
| 19103 | |
| 19104 | |
| 19105 | /* |
| 19106 | * BIOS auto configuration |
| 19107 | */ |
| 19108 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19109 | /* convert from MIX nid to DAC */ |
| 19110 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 19111 | { |
| 19112 | if (nid == 0x0f) |
| 19113 | return 0x02; |
| 19114 | else if (nid >= 0x0c && nid <= 0x0e) |
| 19115 | return nid - 0x0c + 0x02; |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19116 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ |
| 19117 | return 0x25; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19118 | else |
| 19119 | return 0; |
| 19120 | } |
| 19121 | |
| 19122 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 19123 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 19124 | hda_nid_t dac) |
| 19125 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19126 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19127 | int i, num; |
| 19128 | |
| 19129 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 19130 | for (i = 0; i < num; i++) { |
| 19131 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 19132 | return mix[i]; |
| 19133 | } |
| 19134 | return 0; |
| 19135 | } |
| 19136 | |
| 19137 | /* look for an empty DAC slot */ |
| 19138 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 19139 | { |
| 19140 | struct alc_spec *spec = codec->spec; |
| 19141 | hda_nid_t srcs[5]; |
| 19142 | int i, j, num; |
| 19143 | |
| 19144 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 19145 | if (num < 0) |
| 19146 | return 0; |
| 19147 | for (i = 0; i < num; i++) { |
| 19148 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 19149 | if (!nid) |
| 19150 | continue; |
| 19151 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 19152 | if (spec->multiout.dac_nids[j] == nid) |
| 19153 | break; |
| 19154 | if (j >= spec->multiout.num_dacs) |
| 19155 | return nid; |
| 19156 | } |
| 19157 | return 0; |
| 19158 | } |
| 19159 | |
| 19160 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 19161 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 19162 | const struct auto_pin_cfg *cfg) |
| 19163 | { |
| 19164 | struct alc_spec *spec = codec->spec; |
| 19165 | int i; |
| 19166 | hda_nid_t dac; |
| 19167 | |
| 19168 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19169 | for (i = 0; i < cfg->line_outs; i++) { |
| 19170 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 19171 | if (!dac) |
| 19172 | continue; |
| 19173 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19174 | } |
| 19175 | return 0; |
| 19176 | } |
| 19177 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19178 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 19179 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19180 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19181 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19182 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 19183 | } |
| 19184 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19185 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 19186 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19187 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19188 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19189 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19190 | } |
| 19191 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19192 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 19193 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 19194 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 19195 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19196 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19197 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19198 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19199 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19200 | |
| 19201 | /* add playback controls from the parsed DAC table */ |
| 19202 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19203 | const struct auto_pin_cfg *cfg) |
| 19204 | { |
| 19205 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19206 | static const char *chname[4] = { |
| 19207 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19208 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19209 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19210 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19211 | int i, err; |
| 19212 | |
| 19213 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19214 | nid = spec->multiout.dac_nids[i]; |
| 19215 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19216 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19217 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 19218 | if (!mix) |
| 19219 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19220 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19221 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19222 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19223 | if (err < 0) |
| 19224 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19225 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19226 | if (err < 0) |
| 19227 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19228 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19229 | if (err < 0) |
| 19230 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19231 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19232 | if (err < 0) |
| 19233 | return err; |
| 19234 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19235 | const char *name = pfx; |
| 19236 | if (!name) |
| 19237 | name = chname[i]; |
| 19238 | err = __alc662_add_vol_ctl(spec, name, nid, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19239 | if (err < 0) |
| 19240 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19241 | err = __alc662_add_sw_ctl(spec, name, mix, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19242 | if (err < 0) |
| 19243 | return err; |
| 19244 | } |
| 19245 | } |
| 19246 | return 0; |
| 19247 | } |
| 19248 | |
| 19249 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19250 | /* return DAC nid if any new DAC is assigned */ |
| 19251 | 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] | 19252 | const char *pfx) |
| 19253 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19254 | struct alc_spec *spec = codec->spec; |
| 19255 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19256 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19257 | |
| 19258 | if (!pin) |
| 19259 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19260 | nid = alc662_look_for_dac(codec, pin); |
| 19261 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19262 | /* the corresponding DAC is already occupied */ |
| 19263 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19264 | return 0; /* no way */ |
| 19265 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19266 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19267 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19268 | } |
| 19269 | |
| 19270 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19271 | if (!mix) |
| 19272 | return 0; |
| 19273 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19274 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19275 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19276 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19277 | if (err < 0) |
| 19278 | return err; |
| 19279 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19280 | } |
| 19281 | |
| 19282 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19283 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19284 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19285 | |
| 19286 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19287 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19288 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19289 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19290 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19291 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19292 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19293 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19294 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19295 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19296 | if (num <= 1) |
| 19297 | return; |
| 19298 | for (i = 0; i < num; i++) { |
| 19299 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19300 | continue; |
| 19301 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19302 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19303 | } |
| 19304 | } |
| 19305 | |
| 19306 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19307 | { |
| 19308 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19309 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19310 | int i; |
| 19311 | |
| 19312 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19313 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19314 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19315 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19316 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19317 | } |
| 19318 | } |
| 19319 | |
| 19320 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19321 | { |
| 19322 | struct alc_spec *spec = codec->spec; |
| 19323 | hda_nid_t pin; |
| 19324 | |
| 19325 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19326 | if (pin) |
| 19327 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19328 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19329 | pin = spec->autocfg.speaker_pins[0]; |
| 19330 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19331 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19332 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19333 | } |
| 19334 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19335 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19336 | |
| 19337 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19338 | { |
| 19339 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19340 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19341 | int i; |
| 19342 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19343 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19344 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19345 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19346 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19347 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19348 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19349 | snd_hda_codec_write(codec, nid, 0, |
| 19350 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19351 | AMP_OUT_MUTE); |
| 19352 | } |
| 19353 | } |
| 19354 | } |
| 19355 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19356 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19357 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19358 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19359 | { |
| 19360 | struct alc_spec *spec = codec->spec; |
| 19361 | int err; |
| 19362 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19363 | |
| 19364 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19365 | alc662_ignore); |
| 19366 | if (err < 0) |
| 19367 | return err; |
| 19368 | if (!spec->autocfg.line_outs) |
| 19369 | return 0; /* can't find valid BIOS pin config */ |
| 19370 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19371 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19372 | if (err < 0) |
| 19373 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19374 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19375 | if (err < 0) |
| 19376 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19377 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19378 | spec->autocfg.speaker_pins[0], |
| 19379 | "Speaker"); |
| 19380 | if (err < 0) |
| 19381 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19382 | if (err) |
| 19383 | spec->multiout.extra_out_nid[0] = err; |
| 19384 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19385 | "Headphone"); |
| 19386 | if (err < 0) |
| 19387 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19388 | if (err) |
| 19389 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19390 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19391 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19392 | return err; |
| 19393 | |
| 19394 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19395 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19396 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19397 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19398 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19399 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19400 | |
| 19401 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19402 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19403 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19404 | add_verb(spec, alc662_init_verbs); |
| 19405 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19406 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19407 | add_verb(spec, alc663_init_verbs); |
| 19408 | |
| 19409 | if (codec->vendor_id == 0x10ec0272) |
| 19410 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19411 | |
| 19412 | err = alc_auto_add_mic_boost(codec); |
| 19413 | if (err < 0) |
| 19414 | return err; |
| 19415 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19416 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19417 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19418 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19419 | else |
| 19420 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19421 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19422 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19423 | } |
| 19424 | |
| 19425 | /* additional initialization for auto-configuration model */ |
| 19426 | static void alc662_auto_init(struct hda_codec *codec) |
| 19427 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19428 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19429 | alc662_auto_init_multi_out(codec); |
| 19430 | alc662_auto_init_hp_out(codec); |
| 19431 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19432 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19433 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19434 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19435 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19436 | } |
| 19437 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19438 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19439 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19440 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19441 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19442 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19443 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19444 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19445 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19446 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19447 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19448 | printk(KERN_WARNING |
| 19449 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19450 | } |
| 19451 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19452 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19453 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19454 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19455 | ALC272_FIXUP_MARIO, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19456 | }; |
| 19457 | |
| 19458 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19459 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19460 | .type = ALC_FIXUP_PINS, |
| 19461 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19462 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19463 | { } |
| 19464 | } |
| 19465 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19466 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19467 | .type = ALC_FIXUP_PINS, |
| 19468 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19469 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19470 | { } |
| 19471 | } |
| 19472 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19473 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19474 | .type = ALC_FIXUP_FUNC, |
| 19475 | .v.func = alc272_fixup_mario, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19476 | } |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19477 | }; |
| 19478 | |
| 19479 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19480 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19481 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19482 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19483 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 19484 | {} |
| 19485 | }; |
| 19486 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19487 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19488 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19489 | {} |
| 19490 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19491 | |
| 19492 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19493 | static int patch_alc662(struct hda_codec *codec) |
| 19494 | { |
| 19495 | struct alc_spec *spec; |
| 19496 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19497 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19498 | |
| 19499 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19500 | if (!spec) |
| 19501 | return -ENOMEM; |
| 19502 | |
| 19503 | codec->spec = spec; |
| 19504 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19505 | alc_auto_parse_customize_define(codec); |
| 19506 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19507 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19508 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19509 | coef = alc_read_coef_idx(codec, 0); |
| 19510 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19511 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19512 | else if (coef & (1 << 14) && |
| 19513 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19514 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19515 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19516 | else if (coef == 0x4011) |
| 19517 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19518 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19519 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19520 | alc662_models, |
| 19521 | alc662_cfg_tbl); |
| 19522 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19523 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19524 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19525 | board_config = ALC662_AUTO; |
| 19526 | } |
| 19527 | |
| 19528 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19529 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19530 | alc662_fixup_tbl, alc662_fixups); |
| 19531 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19532 | /* automatic parse from the BIOS config */ |
| 19533 | err = alc662_parse_auto_config(codec); |
| 19534 | if (err < 0) { |
| 19535 | alc_free(codec); |
| 19536 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19537 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19538 | printk(KERN_INFO |
| 19539 | "hda_codec: Cannot set up configuration " |
| 19540 | "from BIOS. Using base mode...\n"); |
| 19541 | board_config = ALC662_3ST_2ch_DIG; |
| 19542 | } |
| 19543 | } |
| 19544 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19545 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19546 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19547 | if (err < 0) { |
| 19548 | alc_free(codec); |
| 19549 | return err; |
| 19550 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19551 | } |
| 19552 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19553 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19554 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19555 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19556 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19557 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19558 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19559 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19560 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19561 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19562 | if (!spec->adc_nids) { |
| 19563 | spec->adc_nids = alc662_adc_nids; |
| 19564 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19565 | } |
| 19566 | if (!spec->capsrc_nids) |
| 19567 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19568 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19569 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19570 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19571 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19572 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19573 | switch (codec->vendor_id) { |
| 19574 | case 0x10ec0662: |
| 19575 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19576 | break; |
| 19577 | case 0x10ec0272: |
| 19578 | case 0x10ec0663: |
| 19579 | case 0x10ec0665: |
| 19580 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19581 | break; |
| 19582 | case 0x10ec0273: |
| 19583 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19584 | break; |
| 19585 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19586 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19587 | spec->vmaster_nid = 0x02; |
| 19588 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19589 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19590 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19591 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19592 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19593 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19594 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19595 | alc_init_jacks(codec); |
| 19596 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19597 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19598 | if (!spec->loopback.amplist) |
| 19599 | spec->loopback.amplist = alc662_loopbacks; |
| 19600 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19601 | |
| 19602 | return 0; |
| 19603 | } |
| 19604 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19605 | static int patch_alc888(struct hda_codec *codec) |
| 19606 | { |
| 19607 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19608 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19609 | if (codec->vendor_id == 0x10ec0887) |
| 19610 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19611 | else |
| 19612 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19613 | if (!codec->chip_name) { |
| 19614 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19615 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19616 | } |
| 19617 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19618 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19619 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19620 | } |
| 19621 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19622 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19623 | * ALC680 support |
| 19624 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19625 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19626 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19627 | #define alc680_modes alc260_modes |
| 19628 | |
| 19629 | static hda_nid_t alc680_dac_nids[3] = { |
| 19630 | /* Lout1, Lout2, hp */ |
| 19631 | 0x02, 0x03, 0x04 |
| 19632 | }; |
| 19633 | |
| 19634 | static hda_nid_t alc680_adc_nids[3] = { |
| 19635 | /* ADC0-2 */ |
| 19636 | /* DMIC, MIC, Line-in*/ |
| 19637 | 0x07, 0x08, 0x09 |
| 19638 | }; |
| 19639 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19640 | /* |
| 19641 | * Analog capture ADC cgange |
| 19642 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19643 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19644 | { |
| 19645 | struct alc_spec *spec = codec->spec; |
| 19646 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19647 | int pin_found = 0; |
| 19648 | int type_found = AUTO_PIN_LAST; |
| 19649 | hda_nid_t nid; |
| 19650 | int i; |
| 19651 | |
| 19652 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19653 | nid = cfg->inputs[i].pin; |
| 19654 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19655 | AC_PINCAP_PRES_DETECT)) |
| 19656 | continue; |
| 19657 | if (snd_hda_jack_detect(codec, nid)) { |
| 19658 | if (cfg->inputs[i].type < type_found) { |
| 19659 | type_found = cfg->inputs[i].type; |
| 19660 | pin_found = nid; |
| 19661 | } |
| 19662 | } |
| 19663 | } |
| 19664 | |
| 19665 | nid = 0x07; |
| 19666 | if (pin_found) |
| 19667 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19668 | |
| 19669 | if (nid != spec->cur_adc) |
| 19670 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19671 | spec->cur_adc = nid; |
| 19672 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19673 | spec->cur_adc_format); |
| 19674 | } |
| 19675 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19676 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19677 | struct hda_codec *codec, |
| 19678 | unsigned int stream_tag, |
| 19679 | unsigned int format, |
| 19680 | struct snd_pcm_substream *substream) |
| 19681 | { |
| 19682 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19683 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19684 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19685 | spec->cur_adc_stream_tag = stream_tag; |
| 19686 | spec->cur_adc_format = format; |
| 19687 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19688 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19689 | return 0; |
| 19690 | } |
| 19691 | |
| 19692 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19693 | struct hda_codec *codec, |
| 19694 | struct snd_pcm_substream *substream) |
| 19695 | { |
| 19696 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19697 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19698 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19699 | return 0; |
| 19700 | } |
| 19701 | |
| 19702 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19703 | .substreams = 1, /* can be overridden */ |
| 19704 | .channels_min = 2, |
| 19705 | .channels_max = 2, |
| 19706 | /* NID is set in alc_build_pcms */ |
| 19707 | .ops = { |
| 19708 | .prepare = alc680_capture_pcm_prepare, |
| 19709 | .cleanup = alc680_capture_pcm_cleanup |
| 19710 | }, |
| 19711 | }; |
| 19712 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19713 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19714 | /* output mixer control */ |
| 19715 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19716 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19717 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19718 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19719 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19720 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19721 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19722 | { } |
| 19723 | }; |
| 19724 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19725 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19726 | .ops = &snd_hda_bind_vol, |
| 19727 | .values = { |
| 19728 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19729 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19730 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19731 | 0 |
| 19732 | }, |
| 19733 | }; |
| 19734 | |
| 19735 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19736 | .ops = &snd_hda_bind_sw, |
| 19737 | .values = { |
| 19738 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19739 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19740 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19741 | 0 |
| 19742 | }, |
| 19743 | }; |
| 19744 | |
| 19745 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19746 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19747 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19748 | { } /* end */ |
| 19749 | }; |
| 19750 | |
| 19751 | /* |
| 19752 | * generic initialization of ADC, input mixers and output mixers |
| 19753 | */ |
| 19754 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19755 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19756 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19757 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19758 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19759 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19760 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19761 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19762 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19763 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19765 | |
| 19766 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19767 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19768 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19769 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19770 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19771 | |
| 19772 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19773 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19774 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19775 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19776 | { } |
| 19777 | }; |
| 19778 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19779 | /* toggle speaker-output according to the hp-jack state */ |
| 19780 | static void alc680_base_setup(struct hda_codec *codec) |
| 19781 | { |
| 19782 | struct alc_spec *spec = codec->spec; |
| 19783 | |
| 19784 | spec->autocfg.hp_pins[0] = 0x16; |
| 19785 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19786 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19787 | spec->autocfg.num_inputs = 2; |
| 19788 | spec->autocfg.inputs[0].pin = 0x18; |
| 19789 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19790 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19791 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19792 | } |
| 19793 | |
| 19794 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19795 | unsigned int res) |
| 19796 | { |
| 19797 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19798 | alc_automute_amp(codec); |
| 19799 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19800 | alc680_rec_autoswitch(codec); |
| 19801 | } |
| 19802 | |
| 19803 | static void alc680_inithook(struct hda_codec *codec) |
| 19804 | { |
| 19805 | alc_automute_amp(codec); |
| 19806 | alc680_rec_autoswitch(codec); |
| 19807 | } |
| 19808 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19809 | /* create input playback/capture controls for the given pin */ |
| 19810 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19811 | const char *ctlname, int idx) |
| 19812 | { |
| 19813 | hda_nid_t dac; |
| 19814 | int err; |
| 19815 | |
| 19816 | switch (nid) { |
| 19817 | case 0x14: |
| 19818 | dac = 0x02; |
| 19819 | break; |
| 19820 | case 0x15: |
| 19821 | dac = 0x03; |
| 19822 | break; |
| 19823 | case 0x16: |
| 19824 | dac = 0x04; |
| 19825 | break; |
| 19826 | default: |
| 19827 | return 0; |
| 19828 | } |
| 19829 | if (spec->multiout.dac_nids[0] != dac && |
| 19830 | spec->multiout.dac_nids[1] != dac) { |
| 19831 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19832 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19833 | HDA_OUTPUT)); |
| 19834 | if (err < 0) |
| 19835 | return err; |
| 19836 | |
| 19837 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19838 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19839 | |
| 19840 | if (err < 0) |
| 19841 | return err; |
| 19842 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19843 | } |
| 19844 | |
| 19845 | return 0; |
| 19846 | } |
| 19847 | |
| 19848 | /* add playback controls from the parsed DAC table */ |
| 19849 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19850 | const struct auto_pin_cfg *cfg) |
| 19851 | { |
| 19852 | hda_nid_t nid; |
| 19853 | int err; |
| 19854 | |
| 19855 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19856 | |
| 19857 | nid = cfg->line_out_pins[0]; |
| 19858 | if (nid) { |
| 19859 | const char *name; |
| 19860 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19861 | name = "Speaker"; |
| 19862 | else |
| 19863 | name = "Front"; |
| 19864 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19865 | if (err < 0) |
| 19866 | return err; |
| 19867 | } |
| 19868 | |
| 19869 | nid = cfg->speaker_pins[0]; |
| 19870 | if (nid) { |
| 19871 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19872 | if (err < 0) |
| 19873 | return err; |
| 19874 | } |
| 19875 | nid = cfg->hp_pins[0]; |
| 19876 | if (nid) { |
| 19877 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19878 | if (err < 0) |
| 19879 | return err; |
| 19880 | } |
| 19881 | |
| 19882 | return 0; |
| 19883 | } |
| 19884 | |
| 19885 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19886 | hda_nid_t nid, int pin_type) |
| 19887 | { |
| 19888 | alc_set_pin_output(codec, nid, pin_type); |
| 19889 | } |
| 19890 | |
| 19891 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19892 | { |
| 19893 | struct alc_spec *spec = codec->spec; |
| 19894 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19895 | if (nid) { |
| 19896 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19897 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19898 | } |
| 19899 | } |
| 19900 | |
| 19901 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19902 | { |
| 19903 | struct alc_spec *spec = codec->spec; |
| 19904 | hda_nid_t pin; |
| 19905 | |
| 19906 | pin = spec->autocfg.hp_pins[0]; |
| 19907 | if (pin) |
| 19908 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19909 | pin = spec->autocfg.speaker_pins[0]; |
| 19910 | if (pin) |
| 19911 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19912 | } |
| 19913 | |
| 19914 | /* pcm configuration: identical with ALC880 */ |
| 19915 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19916 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19917 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19918 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19919 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19920 | |
| 19921 | /* |
| 19922 | * BIOS auto configuration |
| 19923 | */ |
| 19924 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19925 | { |
| 19926 | struct alc_spec *spec = codec->spec; |
| 19927 | int err; |
| 19928 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19929 | |
| 19930 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19931 | alc680_ignore); |
| 19932 | if (err < 0) |
| 19933 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19934 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19935 | if (!spec->autocfg.line_outs) { |
| 19936 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19937 | spec->multiout.max_channels = 2; |
| 19938 | spec->no_analog = 1; |
| 19939 | goto dig_only; |
| 19940 | } |
| 19941 | return 0; /* can't find valid BIOS pin config */ |
| 19942 | } |
| 19943 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19944 | if (err < 0) |
| 19945 | return err; |
| 19946 | |
| 19947 | spec->multiout.max_channels = 2; |
| 19948 | |
| 19949 | dig_only: |
| 19950 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19951 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19952 | if (spec->kctls.list) |
| 19953 | add_mixer(spec, spec->kctls.list); |
| 19954 | |
| 19955 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19956 | |
| 19957 | err = alc_auto_add_mic_boost(codec); |
| 19958 | if (err < 0) |
| 19959 | return err; |
| 19960 | |
| 19961 | return 1; |
| 19962 | } |
| 19963 | |
| 19964 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19965 | |
| 19966 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19967 | static void alc680_auto_init(struct hda_codec *codec) |
| 19968 | { |
| 19969 | struct alc_spec *spec = codec->spec; |
| 19970 | alc680_auto_init_multi_out(codec); |
| 19971 | alc680_auto_init_hp_out(codec); |
| 19972 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19973 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19974 | if (spec->unsol_event) |
| 19975 | alc_inithook(codec); |
| 19976 | } |
| 19977 | |
| 19978 | /* |
| 19979 | * configuration and preset |
| 19980 | */ |
| 19981 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19982 | [ALC680_BASE] = "base", |
| 19983 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19984 | }; |
| 19985 | |
| 19986 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19987 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19988 | {} |
| 19989 | }; |
| 19990 | |
| 19991 | static struct alc_config_preset alc680_presets[] = { |
| 19992 | [ALC680_BASE] = { |
| 19993 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19994 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19995 | .init_verbs = { alc680_init_verbs }, |
| 19996 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19997 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19998 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19999 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 20000 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20001 | .unsol_event = alc680_unsol_event, |
| 20002 | .setup = alc680_base_setup, |
| 20003 | .init_hook = alc680_inithook, |
| 20004 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20005 | }, |
| 20006 | }; |
| 20007 | |
| 20008 | static int patch_alc680(struct hda_codec *codec) |
| 20009 | { |
| 20010 | struct alc_spec *spec; |
| 20011 | int board_config; |
| 20012 | int err; |
| 20013 | |
| 20014 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 20015 | if (spec == NULL) |
| 20016 | return -ENOMEM; |
| 20017 | |
| 20018 | codec->spec = spec; |
| 20019 | |
| 20020 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 20021 | alc680_models, |
| 20022 | alc680_cfg_tbl); |
| 20023 | |
| 20024 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 20025 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 20026 | codec->chip_name); |
| 20027 | board_config = ALC680_AUTO; |
| 20028 | } |
| 20029 | |
| 20030 | if (board_config == ALC680_AUTO) { |
| 20031 | /* automatic parse from the BIOS config */ |
| 20032 | err = alc680_parse_auto_config(codec); |
| 20033 | if (err < 0) { |
| 20034 | alc_free(codec); |
| 20035 | return err; |
| 20036 | } else if (!err) { |
| 20037 | printk(KERN_INFO |
| 20038 | "hda_codec: Cannot set up configuration " |
| 20039 | "from BIOS. Using base mode...\n"); |
| 20040 | board_config = ALC680_BASE; |
| 20041 | } |
| 20042 | } |
| 20043 | |
| 20044 | if (board_config != ALC680_AUTO) |
| 20045 | setup_preset(codec, &alc680_presets[board_config]); |
| 20046 | |
| 20047 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20048 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20049 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20050 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20051 | |
| 20052 | if (!spec->adc_nids) { |
| 20053 | spec->adc_nids = alc680_adc_nids; |
| 20054 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 20055 | } |
| 20056 | |
| 20057 | if (!spec->cap_mixer) |
| 20058 | set_capture_mixer(codec); |
| 20059 | |
| 20060 | spec->vmaster_nid = 0x02; |
| 20061 | |
| 20062 | codec->patch_ops = alc_patch_ops; |
| 20063 | if (board_config == ALC680_AUTO) |
| 20064 | spec->init_hook = alc680_auto_init; |
| 20065 | |
| 20066 | return 0; |
| 20067 | } |
| 20068 | |
| 20069 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20070 | * patch entries |
| 20071 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20072 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20073 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20074 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20075 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 20076 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20077 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20078 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 20079 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20080 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20081 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20082 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20083 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 20084 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 20085 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20086 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20087 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20088 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 20089 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 20090 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 20091 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 20092 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20093 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20094 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20095 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20096 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 20097 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20098 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 20099 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20100 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20101 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 20102 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 20103 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20104 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20105 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20106 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20107 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20108 | {} /* terminator */ |
| 20109 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20110 | |
| 20111 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 20112 | |
| 20113 | MODULE_LICENSE("GPL"); |
| 20114 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 20115 | |
| 20116 | static struct hda_codec_preset_list realtek_list = { |
| 20117 | .preset = snd_hda_preset_realtek, |
| 20118 | .owner = THIS_MODULE, |
| 20119 | }; |
| 20120 | |
| 20121 | static int __init patch_realtek_init(void) |
| 20122 | { |
| 20123 | return snd_hda_add_codec_preset(&realtek_list); |
| 20124 | } |
| 20125 | |
| 20126 | static void __exit patch_realtek_exit(void) |
| 20127 | { |
| 20128 | snd_hda_delete_codec_preset(&realtek_list); |
| 20129 | } |
| 20130 | |
| 20131 | module_init(patch_realtek_init) |
| 20132 | module_exit(patch_realtek_exit) |