Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 31 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 34 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 36 | #define ALC880_FRONT_EVENT 0x01 |
| 37 | #define ALC880_DCVOL_EVENT 0x02 |
| 38 | #define ALC880_HP_EVENT 0x04 |
| 39 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* ALC880 board config type */ |
| 42 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | ALC880_3ST, |
| 44 | ALC880_3ST_DIG, |
| 45 | ALC880_5ST, |
| 46 | ALC880_5ST_DIG, |
| 47 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 48 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 49 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 50 | ALC880_6ST_DIG, |
| 51 | ALC880_F1734, |
| 52 | ALC880_ASUS, |
| 53 | ALC880_ASUS_DIG, |
| 54 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 55 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 56 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 58 | ALC880_UNIWILL, |
| 59 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 60 | ALC880_CLEVO, |
| 61 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 62 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 63 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 64 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_SND_DEBUG |
| 66 | ALC880_TEST, |
| 67 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 68 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 69 | ALC880_MODEL_LAST /* last tag */ |
| 70 | }; |
| 71 | |
| 72 | /* ALC260 models */ |
| 73 | enum { |
| 74 | ALC260_BASIC, |
| 75 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 76 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 77 | ALC260_HP_3013, |
| 78 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 79 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 80 | ALC260_WILL, |
| 81 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 82 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 83 | #ifdef CONFIG_SND_DEBUG |
| 84 | ALC260_TEST, |
| 85 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 87 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 90 | /* ALC262 models */ |
| 91 | enum { |
| 92 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 93 | ALC262_HIPPO, |
| 94 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 95 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 96 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 97 | ALC262_HP_BPC_D7000_WL, |
| 98 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 99 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 100 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 101 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 102 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 103 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 104 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 105 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 106 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 108 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 109 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 110 | ALC262_AUTO, |
| 111 | ALC262_MODEL_LAST /* last tag */ |
| 112 | }; |
| 113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | /* ALC268 models */ |
| 115 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 116 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 117 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 118 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 119 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 120 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 121 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 122 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 123 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 124 | #ifdef CONFIG_SND_DEBUG |
| 125 | ALC268_TEST, |
| 126 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 127 | ALC268_AUTO, |
| 128 | ALC268_MODEL_LAST /* last tag */ |
| 129 | }; |
| 130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | /* ALC269 models */ |
| 132 | enum { |
| 133 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 134 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 135 | ALC269_AMIC, |
| 136 | ALC269_DMIC, |
| 137 | ALC269VB_AMIC, |
| 138 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 139 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 140 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 141 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 142 | ALC269_AUTO, |
| 143 | ALC269_MODEL_LAST /* last tag */ |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC861 models */ |
| 147 | enum { |
| 148 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 149 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_3ST_DIG, |
| 151 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 152 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 153 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 154 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 155 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC861_AUTO, |
| 157 | ALC861_MODEL_LAST, |
| 158 | }; |
| 159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | /* ALC861-VD models */ |
| 161 | enum { |
| 162 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 163 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 164 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_3ST, |
| 166 | ALC861VD_3ST_DIG, |
| 167 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 168 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 170 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 171 | ALC861VD_AUTO, |
| 172 | ALC861VD_MODEL_LAST, |
| 173 | }; |
| 174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | /* ALC662 models */ |
| 176 | enum { |
| 177 | ALC662_3ST_2ch_DIG, |
| 178 | ALC662_3ST_6ch_DIG, |
| 179 | ALC662_3ST_6ch, |
| 180 | ALC662_5ST_DIG, |
| 181 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 183 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 184 | ALC663_ASUS_M51VA, |
| 185 | ALC663_ASUS_G71V, |
| 186 | ALC663_ASUS_H13, |
| 187 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 188 | ALC662_ECS, |
| 189 | ALC663_ASUS_MODE1, |
| 190 | ALC662_ASUS_MODE2, |
| 191 | ALC663_ASUS_MODE3, |
| 192 | ALC663_ASUS_MODE4, |
| 193 | ALC663_ASUS_MODE5, |
| 194 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 195 | ALC663_ASUS_MODE7, |
| 196 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 197 | ALC272_DELL, |
| 198 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 199 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 200 | ALC662_AUTO, |
| 201 | ALC662_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* ALC882 models */ |
| 205 | enum { |
| 206 | ALC882_3ST_DIG, |
| 207 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 208 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 209 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC882_TARGA, |
| 211 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 212 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 213 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 214 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 215 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 216 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 217 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 218 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 219 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | ALC883_3ST_2ch_DIG, |
| 221 | ALC883_3ST_6ch_DIG, |
| 222 | ALC883_3ST_6ch, |
| 223 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 224 | ALC883_TARGA_DIG, |
| 225 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 226 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a867 | 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 | |
| 285 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 286 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 287 | struct alc_customize_define { |
| 288 | unsigned int sku_cfg; |
| 289 | unsigned char port_connectivity; |
| 290 | unsigned char check_sum; |
| 291 | unsigned char customization; |
| 292 | unsigned char external_amp; |
| 293 | unsigned int enable_pcbeep:1; |
| 294 | unsigned int platform_type:1; |
| 295 | unsigned int swap:1; |
| 296 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 297 | 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] | 298 | }; |
| 299 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 300 | struct alc_fixup; |
| 301 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | struct alc_spec { |
| 303 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 304 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 306 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 307 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 309 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 310 | * don't forget NULL |
| 311 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 312 | */ |
| 313 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 315 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | struct hda_pcm_stream *stream_analog_playback; |
| 317 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 318 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 319 | struct hda_pcm_stream *stream_analog_alt_capture; |
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_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | struct hda_pcm_stream *stream_digital_playback; |
| 323 | struct hda_pcm_stream *stream_digital_capture; |
| 324 | |
| 325 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 326 | struct hda_multi_out multiout; /* playback set-up |
| 327 | * max_channels, dacs must be set |
| 328 | * dig_out_nid and hp_nid are optional |
| 329 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 330 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 331 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 332 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | |
| 334 | /* capture */ |
| 335 | unsigned int num_adc_nids; |
| 336 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 337 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 338 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 340 | /* capture setup for dynamic dual-adc switch */ |
| 341 | unsigned int cur_adc_idx; |
| 342 | hda_nid_t cur_adc; |
| 343 | unsigned int cur_adc_stream_tag; |
| 344 | unsigned int cur_adc_format; |
| 345 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 347 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | const struct hda_input_mux *input_mux; |
| 349 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 350 | struct alc_mic_route ext_mic; |
| 351 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | |
| 353 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 354 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 356 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 357 | int const_channel_count; |
| 358 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | |
| 360 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 361 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 362 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 363 | /* dynamic controls, init_verbs and input_mux */ |
| 364 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 365 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 366 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 367 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 368 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 369 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 370 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 371 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 372 | /* hooks */ |
| 373 | void (*init_hook)(struct hda_codec *codec); |
| 374 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 375 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 376 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 377 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 378 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 379 | /* for pin sensing */ |
| 380 | unsigned int sense_updated: 1; |
| 381 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 382 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 383 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 384 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 385 | /* other flags */ |
| 386 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 387 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 388 | unsigned int single_input_src:1; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 389 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 390 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 391 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 392 | /* for virtual master */ |
| 393 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 394 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 395 | struct hda_loopback_check loopback; |
| 396 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 397 | |
| 398 | /* for PLL fix */ |
| 399 | hda_nid_t pll_nid; |
| 400 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 401 | |
| 402 | /* fix-up list */ |
| 403 | int fixup_id; |
| 404 | const struct alc_fixup *fixup_list; |
| 405 | const char *fixup_name; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 406 | }; |
| 407 | |
| 408 | /* |
| 409 | * configuration template - to be copied to the spec instance |
| 410 | */ |
| 411 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 412 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 413 | * with spec |
| 414 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 415 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 416 | const struct hda_verb *init_verbs[5]; |
| 417 | unsigned int num_dacs; |
| 418 | hda_nid_t *dac_nids; |
| 419 | hda_nid_t dig_out_nid; /* optional */ |
| 420 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 421 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 422 | unsigned int num_adc_nids; |
| 423 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 424 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 425 | hda_nid_t dig_in_nid; |
| 426 | unsigned int num_channel_mode; |
| 427 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 428 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 429 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 430 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 431 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 432 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 433 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 434 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 435 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 436 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 437 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 438 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | }; |
| 440 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | |
| 442 | /* |
| 443 | * input MUX handling |
| 444 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 445 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 446 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | { |
| 448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 449 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 450 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 451 | if (mux_idx >= spec->num_mux_defs) |
| 452 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 453 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 454 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 455 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | } |
| 457 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 459 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | { |
| 461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 462 | struct alc_spec *spec = codec->spec; |
| 463 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 464 | |
| 465 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 466 | return 0; |
| 467 | } |
| 468 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 469 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 470 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | { |
| 472 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 473 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 474 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 476 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 477 | hda_nid_t nid = spec->capsrc_nids ? |
| 478 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 479 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 481 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 482 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 483 | if (!imux->num_items && mux_idx > 0) |
| 484 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 485 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 486 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 487 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 488 | /* Matrix-mixer style (e.g. ALC882) */ |
| 489 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 490 | unsigned int i, idx; |
| 491 | |
| 492 | idx = ucontrol->value.enumerated.item[0]; |
| 493 | if (idx >= imux->num_items) |
| 494 | idx = imux->num_items - 1; |
| 495 | if (*cur_val == idx) |
| 496 | return 0; |
| 497 | for (i = 0; i < imux->num_items; i++) { |
| 498 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 499 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 500 | imux->items[i].index, |
| 501 | HDA_AMP_MUTE, v); |
| 502 | } |
| 503 | *cur_val = idx; |
| 504 | return 1; |
| 505 | } else { |
| 506 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 507 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 508 | &spec->cur_mux[adc_idx]); |
| 509 | } |
| 510 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 511 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | /* |
| 513 | * channel mode setting |
| 514 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 515 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 516 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 517 | { |
| 518 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 519 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 520 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 521 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | } |
| 523 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 524 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 525 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | { |
| 527 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 528 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 529 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 530 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 531 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | } |
| 533 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 534 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 535 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | { |
| 537 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 538 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 539 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 540 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 541 | &spec->ext_channel_count); |
| 542 | if (err >= 0 && !spec->const_channel_count) { |
| 543 | spec->multiout.max_channels = spec->ext_channel_count; |
| 544 | if (spec->need_dac_fix) |
| 545 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 546 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 547 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | } |
| 549 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 551 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 552 | * instead of "%" to avoid consequences of accidentally treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 553 | * being part of a format specifier. Maximum allowed length of a value is |
| 554 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 555 | * |
| 556 | * Note: some retasking pin complexes seem to ignore requests for input |
| 557 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 558 | * are requested. Therefore order this list so that this behaviour will not |
| 559 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 560 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 561 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 562 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 563 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 564 | "Mic 50pc bias", "Mic 80pc bias", |
| 565 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | }; |
| 567 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 568 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 569 | }; |
| 570 | /* 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] | 571 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 572 | * addition, "input" pins may or may not process the mic bias option |
| 573 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 574 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 575 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 577 | #define ALC_PIN_DIR_IN 0x00 |
| 578 | #define ALC_PIN_DIR_OUT 0x01 |
| 579 | #define ALC_PIN_DIR_INOUT 0x02 |
| 580 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 581 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 582 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 583 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 584 | * For each direction the minimum and maximum values are given. |
| 585 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 586 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 587 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 588 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 589 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 590 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 591 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 592 | }; |
| 593 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 594 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 595 | #define alc_pin_mode_n_items(_dir) \ |
| 596 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 597 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 598 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 599 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 600 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 601 | unsigned int item_num = uinfo->value.enumerated.item; |
| 602 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 603 | |
| 604 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 605 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 606 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 607 | |
| 608 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 609 | item_num = alc_pin_mode_min(dir); |
| 610 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 611 | return 0; |
| 612 | } |
| 613 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 614 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 615 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 616 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 617 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 618 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 619 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 620 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 621 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 622 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 623 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 624 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 625 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 626 | /* Find enumerated value for current pinctl setting */ |
| 627 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 628 | 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] | 629 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 630 | *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] | 631 | return 0; |
| 632 | } |
| 633 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 634 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 635 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 636 | { |
| 637 | signed int change; |
| 638 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 639 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 640 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 641 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 642 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 643 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 644 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 645 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 646 | 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] | 647 | val = alc_pin_mode_min(dir); |
| 648 | |
| 649 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 650 | if (change) { |
| 651 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 652 | snd_hda_codec_write_cache(codec, nid, 0, |
| 653 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 654 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 655 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 656 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 657 | * for the requested pin mode. Enum values of 2 or less are |
| 658 | * input modes. |
| 659 | * |
| 660 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 661 | * reduces noise slightly (particularly on input) so we'll |
| 662 | * do it. However, having both input and output buffers |
| 663 | * enabled simultaneously doesn't seem to be problematic if |
| 664 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 665 | */ |
| 666 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 667 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 668 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 669 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 670 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 671 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 672 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 673 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 674 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 675 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 676 | } |
| 677 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 678 | return change; |
| 679 | } |
| 680 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 681 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 682 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 683 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 684 | .info = alc_pin_mode_info, \ |
| 685 | .get = alc_pin_mode_get, \ |
| 686 | .put = alc_pin_mode_put, \ |
| 687 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 688 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 689 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 690 | * together using a mask with more than one bit set. This control is |
| 691 | * currently used only by the ALC260 test model. At this stage they are not |
| 692 | * needed for any "production" models. |
| 693 | */ |
| 694 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 695 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 696 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 697 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 698 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 699 | { |
| 700 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 701 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 702 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 703 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 704 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 705 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 706 | |
| 707 | *valp = (val & mask) != 0; |
| 708 | return 0; |
| 709 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 710 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 711 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 712 | { |
| 713 | signed int change; |
| 714 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 715 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 716 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 717 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 718 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 719 | AC_VERB_GET_GPIO_DATA, |
| 720 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 721 | |
| 722 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 723 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 724 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 725 | gpio_data &= ~mask; |
| 726 | else |
| 727 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 728 | snd_hda_codec_write_cache(codec, nid, 0, |
| 729 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 730 | |
| 731 | return change; |
| 732 | } |
| 733 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 734 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 735 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 736 | .info = alc_gpio_data_info, \ |
| 737 | .get = alc_gpio_data_get, \ |
| 738 | .put = alc_gpio_data_put, \ |
| 739 | .private_value = nid | (mask<<16) } |
| 740 | #endif /* CONFIG_SND_DEBUG */ |
| 741 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 742 | /* A switch control to allow the enabling of the digital IO pins on the |
| 743 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 744 | * to provide something in the test model allowing digital outputs to be |
| 745 | * identified if present. If models are found which can utilise these |
| 746 | * outputs a more complete mixer control can be devised for those models if |
| 747 | * necessary. |
| 748 | */ |
| 749 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 750 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 751 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 752 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 753 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 754 | { |
| 755 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 756 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 757 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 758 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 759 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 760 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 761 | |
| 762 | *valp = (val & mask) != 0; |
| 763 | return 0; |
| 764 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 765 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 766 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 767 | { |
| 768 | signed int change; |
| 769 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 770 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 771 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 772 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 773 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 774 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 775 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 776 | |
| 777 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 778 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 779 | if (val==0) |
| 780 | ctrl_data &= ~mask; |
| 781 | else |
| 782 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 783 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 784 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 785 | |
| 786 | return change; |
| 787 | } |
| 788 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 789 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 790 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 791 | .info = alc_spdif_ctrl_info, \ |
| 792 | .get = alc_spdif_ctrl_get, \ |
| 793 | .put = alc_spdif_ctrl_put, \ |
| 794 | .private_value = nid | (mask<<16) } |
| 795 | #endif /* CONFIG_SND_DEBUG */ |
| 796 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 797 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 798 | * Again, this is only used in the ALC26x test models to help identify when |
| 799 | * the EAPD line must be asserted for features to work. |
| 800 | */ |
| 801 | #ifdef CONFIG_SND_DEBUG |
| 802 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 803 | |
| 804 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 805 | struct snd_ctl_elem_value *ucontrol) |
| 806 | { |
| 807 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 808 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 809 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 810 | long *valp = ucontrol->value.integer.value; |
| 811 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 812 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 813 | |
| 814 | *valp = (val & mask) != 0; |
| 815 | return 0; |
| 816 | } |
| 817 | |
| 818 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 819 | struct snd_ctl_elem_value *ucontrol) |
| 820 | { |
| 821 | int change; |
| 822 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 823 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 824 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 825 | long val = *ucontrol->value.integer.value; |
| 826 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 827 | AC_VERB_GET_EAPD_BTLENABLE, |
| 828 | 0x00); |
| 829 | |
| 830 | /* Set/unset the masked control bit(s) as needed */ |
| 831 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 832 | if (!val) |
| 833 | ctrl_data &= ~mask; |
| 834 | else |
| 835 | ctrl_data |= mask; |
| 836 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 837 | ctrl_data); |
| 838 | |
| 839 | return change; |
| 840 | } |
| 841 | |
| 842 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 843 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 844 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 845 | .info = alc_eapd_ctrl_info, \ |
| 846 | .get = alc_eapd_ctrl_get, \ |
| 847 | .put = alc_eapd_ctrl_put, \ |
| 848 | .private_value = nid | (mask<<16) } |
| 849 | #endif /* CONFIG_SND_DEBUG */ |
| 850 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 851 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 852 | * set up the input pin config (depending on the given auto-pin type) |
| 853 | */ |
| 854 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 855 | int auto_pin_type) |
| 856 | { |
| 857 | unsigned int val = PIN_IN; |
| 858 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 859 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 860 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 861 | unsigned int oldval; |
| 862 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 863 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 864 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 865 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 866 | /* if the default pin setup is vref50, we give it priority */ |
| 867 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 868 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 869 | else if (pincap & AC_PINCAP_VREF_50) |
| 870 | val = PIN_VREF50; |
| 871 | else if (pincap & AC_PINCAP_VREF_100) |
| 872 | val = PIN_VREF100; |
| 873 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 874 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 875 | } |
| 876 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 877 | } |
| 878 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 879 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 880 | { |
| 881 | struct alc_spec *spec = codec->spec; |
| 882 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 883 | |
| 884 | if (!cfg->line_outs) { |
| 885 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 886 | cfg->line_out_pins[cfg->line_outs]) |
| 887 | cfg->line_outs++; |
| 888 | } |
| 889 | if (!cfg->speaker_outs) { |
| 890 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 891 | cfg->speaker_pins[cfg->speaker_outs]) |
| 892 | cfg->speaker_outs++; |
| 893 | } |
| 894 | if (!cfg->hp_outs) { |
| 895 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 896 | cfg->hp_pins[cfg->hp_outs]) |
| 897 | cfg->hp_outs++; |
| 898 | } |
| 899 | } |
| 900 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 901 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 902 | */ |
| 903 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 904 | { |
| 905 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 906 | return; |
| 907 | spec->mixers[spec->num_mixers++] = mix; |
| 908 | } |
| 909 | |
| 910 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 911 | { |
| 912 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 913 | return; |
| 914 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 915 | } |
| 916 | |
| 917 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 918 | * set up from the preset table |
| 919 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 920 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 921 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 922 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 923 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 924 | int i; |
| 925 | |
| 926 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 927 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 928 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 929 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 930 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 931 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 932 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 933 | spec->channel_mode = preset->channel_mode; |
| 934 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 935 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 936 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 937 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 938 | if (preset->const_channel_count) |
| 939 | spec->multiout.max_channels = preset->const_channel_count; |
| 940 | else |
| 941 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 942 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 943 | |
| 944 | spec->multiout.num_dacs = preset->num_dacs; |
| 945 | spec->multiout.dac_nids = preset->dac_nids; |
| 946 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 947 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 948 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 949 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 950 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 951 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 952 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 953 | spec->input_mux = preset->input_mux; |
| 954 | |
| 955 | spec->num_adc_nids = preset->num_adc_nids; |
| 956 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 957 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 958 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 959 | |
| 960 | spec->unsol_event = preset->unsol_event; |
| 961 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 962 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 963 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 964 | spec->loopback.amplist = preset->loopbacks; |
| 965 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 966 | |
| 967 | if (preset->setup) |
| 968 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 969 | |
| 970 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 971 | } |
| 972 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 973 | /* Enable GPIO mask and set output */ |
| 974 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 975 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 976 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 977 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 978 | { } |
| 979 | }; |
| 980 | |
| 981 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 982 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 983 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 984 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 985 | { } |
| 986 | }; |
| 987 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 988 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 989 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 990 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 991 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 992 | { } |
| 993 | }; |
| 994 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 995 | /* |
| 996 | * Fix hardware PLL issue |
| 997 | * On some codecs, the analog PLL gating control must be off while |
| 998 | * the default value is 1. |
| 999 | */ |
| 1000 | static void alc_fix_pll(struct hda_codec *codec) |
| 1001 | { |
| 1002 | struct alc_spec *spec = codec->spec; |
| 1003 | unsigned int val; |
| 1004 | |
| 1005 | if (!spec->pll_nid) |
| 1006 | return; |
| 1007 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1008 | spec->pll_coef_idx); |
| 1009 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1010 | AC_VERB_GET_PROC_COEF, 0); |
| 1011 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1012 | spec->pll_coef_idx); |
| 1013 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1014 | val & ~(1 << spec->pll_coef_bit)); |
| 1015 | } |
| 1016 | |
| 1017 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1018 | unsigned int coef_idx, unsigned int coef_bit) |
| 1019 | { |
| 1020 | struct alc_spec *spec = codec->spec; |
| 1021 | spec->pll_nid = nid; |
| 1022 | spec->pll_coef_idx = coef_idx; |
| 1023 | spec->pll_coef_bit = coef_bit; |
| 1024 | alc_fix_pll(codec); |
| 1025 | } |
| 1026 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1027 | static int alc_init_jacks(struct hda_codec *codec) |
| 1028 | { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1029 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1030 | struct alc_spec *spec = codec->spec; |
| 1031 | int err; |
| 1032 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1033 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1034 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1035 | if (hp_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1036 | err = snd_hda_input_jack_add(codec, hp_nid, |
| 1037 | SND_JACK_HEADPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1038 | if (err < 0) |
| 1039 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1040 | snd_hda_input_jack_report(codec, hp_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1041 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1042 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1043 | if (mic_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1044 | err = snd_hda_input_jack_add(codec, mic_nid, |
| 1045 | SND_JACK_MICROPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1046 | if (err < 0) |
| 1047 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1048 | snd_hda_input_jack_report(codec, mic_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1049 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1050 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1051 | return 0; |
| 1052 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1053 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1054 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1055 | { |
| 1056 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1057 | unsigned int mute; |
| 1058 | hda_nid_t nid; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1059 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1060 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1061 | spec->jack_present = 0; |
| 1062 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1063 | nid = spec->autocfg.hp_pins[i]; |
| 1064 | if (!nid) |
| 1065 | break; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1066 | snd_hda_input_jack_report(codec, nid); |
David Henningsson | f0ce279 | 2011-02-28 15:58:07 +0100 | [diff] [blame] | 1067 | spec->jack_present |= snd_hda_jack_detect(codec, nid); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1068 | } |
| 1069 | |
| 1070 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
| 1071 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1072 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1073 | nid = spec->autocfg.speaker_pins[i]; |
| 1074 | if (!nid) |
| 1075 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1076 | if (pinctl) { |
| 1077 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1078 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1079 | spec->jack_present ? 0 : PIN_OUT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1080 | } else { |
| 1081 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1082 | HDA_AMP_MUTE, mute); |
| 1083 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1084 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1085 | } |
| 1086 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1087 | static void alc_automute_pin(struct hda_codec *codec) |
| 1088 | { |
| 1089 | alc_automute_speaker(codec, 1); |
| 1090 | } |
| 1091 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1092 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1093 | hda_nid_t nid) |
| 1094 | { |
| 1095 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1096 | int i, nums; |
| 1097 | |
| 1098 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1099 | for (i = 0; i < nums; i++) |
| 1100 | if (conn[i] == nid) |
| 1101 | return i; |
| 1102 | return -1; |
| 1103 | } |
| 1104 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1105 | /* switch the current ADC according to the jack state */ |
| 1106 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1107 | { |
| 1108 | struct alc_spec *spec = codec->spec; |
| 1109 | unsigned int present; |
| 1110 | hda_nid_t new_adc; |
| 1111 | |
| 1112 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1113 | if (present) |
| 1114 | spec->cur_adc_idx = 1; |
| 1115 | else |
| 1116 | spec->cur_adc_idx = 0; |
| 1117 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1118 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1119 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1120 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1121 | spec->cur_adc = new_adc; |
| 1122 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1123 | spec->cur_adc_stream_tag, 0, |
| 1124 | spec->cur_adc_format); |
| 1125 | } |
| 1126 | } |
| 1127 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1128 | static void alc_mic_automute(struct hda_codec *codec) |
| 1129 | { |
| 1130 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1131 | struct alc_mic_route *dead, *alive; |
| 1132 | unsigned int present, type; |
| 1133 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1134 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1135 | if (!spec->auto_mic) |
| 1136 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1137 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1138 | return; |
| 1139 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1140 | return; |
| 1141 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1142 | if (spec->dual_adc_switch) { |
| 1143 | alc_dual_mic_adc_auto_switch(codec); |
| 1144 | return; |
| 1145 | } |
| 1146 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1147 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1148 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1149 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1150 | if (present) { |
| 1151 | alive = &spec->ext_mic; |
| 1152 | dead = &spec->int_mic; |
| 1153 | } else { |
| 1154 | alive = &spec->int_mic; |
| 1155 | dead = &spec->ext_mic; |
| 1156 | } |
| 1157 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1158 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1159 | if (type == AC_WID_AUD_MIX) { |
| 1160 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1161 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1162 | alive->mux_idx, |
| 1163 | HDA_AMP_MUTE, 0); |
| 1164 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1165 | dead->mux_idx, |
| 1166 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1167 | } else { |
| 1168 | /* MUX style (e.g. ALC880) */ |
| 1169 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1170 | AC_VERB_SET_CONNECT_SEL, |
| 1171 | alive->mux_idx); |
| 1172 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1173 | snd_hda_input_jack_report(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1174 | |
| 1175 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1176 | } |
| 1177 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1178 | /* unsolicited event for HP jack sensing */ |
| 1179 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1180 | { |
| 1181 | if (codec->vendor_id == 0x10ec0880) |
| 1182 | res >>= 28; |
| 1183 | else |
| 1184 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1185 | switch (res) { |
| 1186 | case ALC880_HP_EVENT: |
| 1187 | alc_automute_pin(codec); |
| 1188 | break; |
| 1189 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1190 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1191 | break; |
| 1192 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1193 | } |
| 1194 | |
| 1195 | static void alc_inithook(struct hda_codec *codec) |
| 1196 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1197 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1198 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1199 | } |
| 1200 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1201 | /* additional initialization for ALC888 variants */ |
| 1202 | static void alc888_coef_init(struct hda_codec *codec) |
| 1203 | { |
| 1204 | unsigned int tmp; |
| 1205 | |
| 1206 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1207 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1208 | 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] | 1209 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1210 | /* alc888S-VC */ |
| 1211 | snd_hda_codec_read(codec, 0x20, 0, |
| 1212 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1213 | else |
| 1214 | /* alc888-VB */ |
| 1215 | snd_hda_codec_read(codec, 0x20, 0, |
| 1216 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1217 | } |
| 1218 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1219 | static void alc889_coef_init(struct hda_codec *codec) |
| 1220 | { |
| 1221 | unsigned int tmp; |
| 1222 | |
| 1223 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1224 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1225 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1226 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1227 | } |
| 1228 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1229 | /* turn on/off EAPD control (only if available) */ |
| 1230 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1231 | { |
| 1232 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1233 | return; |
| 1234 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1235 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1236 | on ? 2 : 0); |
| 1237 | } |
| 1238 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1239 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1240 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1241 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1242 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1243 | switch (type) { |
| 1244 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1245 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1246 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1247 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1248 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1249 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1250 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1251 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1252 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1253 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1254 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1255 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1256 | set_eapd(codec, 0x0f, 1); |
| 1257 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1258 | break; |
| 1259 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1260 | case 0x10ec0267: |
| 1261 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1262 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1263 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1264 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1265 | case 0x10ec0660: |
| 1266 | case 0x10ec0662: |
| 1267 | case 0x10ec0663: |
Andres Mejia | 75eb1c3 | 2011-03-20 14:07:40 -0400 | [diff] [blame] | 1268 | case 0x10ec0665: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1269 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1270 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1271 | set_eapd(codec, 0x14, 1); |
| 1272 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1273 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1274 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1275 | switch (codec->vendor_id) { |
| 1276 | case 0x10ec0260: |
| 1277 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1278 | AC_VERB_SET_COEF_INDEX, 7); |
| 1279 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1280 | AC_VERB_GET_PROC_COEF, 0); |
| 1281 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1282 | AC_VERB_SET_COEF_INDEX, 7); |
| 1283 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1284 | AC_VERB_SET_PROC_COEF, |
| 1285 | tmp | 0x2010); |
| 1286 | break; |
| 1287 | case 0x10ec0262: |
| 1288 | case 0x10ec0880: |
| 1289 | case 0x10ec0882: |
| 1290 | case 0x10ec0883: |
| 1291 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1292 | case 0x10ec0887: |
Takashi Iwai | 20b67dd | 2011-03-23 22:54:32 +0100 | [diff] [blame] | 1293 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1294 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1295 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1296 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1297 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1298 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1299 | #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] | 1300 | case 0x10ec0267: |
| 1301 | case 0x10ec0268: |
| 1302 | snd_hda_codec_write(codec, 0x20, 0, |
| 1303 | AC_VERB_SET_COEF_INDEX, 7); |
| 1304 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1305 | AC_VERB_GET_PROC_COEF, 0); |
| 1306 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1307 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1308 | snd_hda_codec_write(codec, 0x20, 0, |
| 1309 | AC_VERB_SET_PROC_COEF, |
| 1310 | tmp | 0x3000); |
| 1311 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1312 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1313 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1314 | break; |
| 1315 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1316 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1317 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1318 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1319 | { |
| 1320 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1321 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1322 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1323 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1324 | if (!cfg->hp_pins[0]) { |
| 1325 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1326 | return; |
| 1327 | } |
| 1328 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1329 | if (!cfg->speaker_pins[0]) { |
| 1330 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1331 | return; |
| 1332 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1333 | sizeof(cfg->speaker_pins)); |
| 1334 | cfg->speaker_outs = cfg->line_outs; |
| 1335 | } |
| 1336 | |
| 1337 | if (!cfg->hp_pins[0]) { |
| 1338 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1339 | sizeof(cfg->hp_pins)); |
| 1340 | cfg->hp_outs = cfg->line_outs; |
| 1341 | } |
| 1342 | |
| 1343 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1344 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1345 | cfg->hp_pins[i]); |
| 1346 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1347 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1348 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1349 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1350 | spec->unsol_event = alc_sku_unsol_event; |
| 1351 | } |
| 1352 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1353 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1354 | { |
| 1355 | struct alc_spec *spec = codec->spec; |
| 1356 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1357 | hda_nid_t fixed, ext; |
| 1358 | int i; |
| 1359 | |
| 1360 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1361 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1362 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1363 | return; |
| 1364 | |
| 1365 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1366 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1367 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1368 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1369 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1370 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1371 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1372 | if (fixed) |
| 1373 | return; /* already occupied */ |
| 1374 | fixed = nid; |
| 1375 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1376 | case INPUT_PIN_ATTR_UNUSED: |
| 1377 | return; /* invalid entry */ |
| 1378 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1379 | if (ext) |
| 1380 | return; /* already occupied */ |
| 1381 | ext = nid; |
| 1382 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1383 | } |
| 1384 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1385 | if (!ext || !fixed) |
| 1386 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1387 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1388 | return; /* no unsol support */ |
| 1389 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1390 | ext, fixed); |
| 1391 | spec->ext_mic.pin = ext; |
| 1392 | spec->int_mic.pin = fixed; |
| 1393 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1394 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1395 | spec->auto_mic = 1; |
| 1396 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1397 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1398 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1399 | spec->unsol_event = alc_sku_unsol_event; |
| 1400 | } |
| 1401 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1402 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1403 | * the driver to ignore any present sku defines. |
| 1404 | */ |
| 1405 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1406 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1407 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1408 | { |
| 1409 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1410 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1411 | struct alc_spec *spec = codec->spec; |
| 1412 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1413 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1414 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1415 | if (spec->cdefine.fixup) { |
| 1416 | ass = spec->cdefine.sku_cfg; |
| 1417 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1418 | return -1; |
| 1419 | goto do_sku; |
| 1420 | } |
| 1421 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1422 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1423 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1424 | goto do_sku; |
| 1425 | |
| 1426 | nid = 0x1d; |
| 1427 | if (codec->vendor_id == 0x10ec0260) |
| 1428 | nid = 0x17; |
| 1429 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1430 | |
| 1431 | if (!(ass & 1)) { |
| 1432 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1433 | codec->chip_name, ass); |
| 1434 | return -1; |
| 1435 | } |
| 1436 | |
| 1437 | /* check sum */ |
| 1438 | tmp = 0; |
| 1439 | for (i = 1; i < 16; i++) { |
| 1440 | if ((ass >> i) & 1) |
| 1441 | tmp++; |
| 1442 | } |
| 1443 | if (((ass >> 16) & 0xf) != tmp) |
| 1444 | return -1; |
| 1445 | |
| 1446 | spec->cdefine.port_connectivity = ass >> 30; |
| 1447 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1448 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1449 | spec->cdefine.customization = ass >> 8; |
| 1450 | do_sku: |
| 1451 | spec->cdefine.sku_cfg = ass; |
| 1452 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1453 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1454 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1455 | spec->cdefine.override = ass & 0x1; |
| 1456 | |
| 1457 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1458 | nid, spec->cdefine.sku_cfg); |
| 1459 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1460 | spec->cdefine.port_connectivity); |
| 1461 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1462 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1463 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1464 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1465 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1466 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1467 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1468 | |
| 1469 | return 0; |
| 1470 | } |
| 1471 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1472 | /* check subsystem ID and set up device-specific initialization; |
| 1473 | * return 1 if initialized, 0 if invalid SSID |
| 1474 | */ |
| 1475 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1476 | * 31 ~ 16 : Manufacture ID |
| 1477 | * 15 ~ 8 : SKU ID |
| 1478 | * 7 ~ 0 : Assembly ID |
| 1479 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1480 | */ |
| 1481 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1482 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1483 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1484 | { |
| 1485 | unsigned int ass, tmp, i; |
| 1486 | unsigned nid; |
| 1487 | struct alc_spec *spec = codec->spec; |
| 1488 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1489 | if (spec->cdefine.fixup) { |
| 1490 | ass = spec->cdefine.sku_cfg; |
| 1491 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1492 | return 0; |
| 1493 | goto do_sku; |
| 1494 | } |
| 1495 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1496 | ass = codec->subsystem_id & 0xffff; |
| 1497 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1498 | goto do_sku; |
| 1499 | |
| 1500 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1501 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1502 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1503 | * 29~21 : reserve |
| 1504 | * 20 : PCBEEP input |
| 1505 | * 19~16 : Check sum (15:1) |
| 1506 | * 15~1 : Custom |
| 1507 | * 0 : override |
| 1508 | */ |
| 1509 | nid = 0x1d; |
| 1510 | if (codec->vendor_id == 0x10ec0260) |
| 1511 | nid = 0x17; |
| 1512 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1513 | snd_printd("realtek: No valid SSID, " |
| 1514 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1515 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1516 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1517 | return 0; |
| 1518 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1519 | return 0; |
| 1520 | |
| 1521 | /* check sum */ |
| 1522 | tmp = 0; |
| 1523 | for (i = 1; i < 16; i++) { |
| 1524 | if ((ass >> i) & 1) |
| 1525 | tmp++; |
| 1526 | } |
| 1527 | if (((ass >> 16) & 0xf) != tmp) |
| 1528 | return 0; |
| 1529 | do_sku: |
| 1530 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1531 | ass & 0xffff, codec->vendor_id); |
| 1532 | /* |
| 1533 | * 0 : override |
| 1534 | * 1 : Swap Jack |
| 1535 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1536 | * 3~5 : External Amplifier control |
| 1537 | * 7~6 : Reserved |
| 1538 | */ |
| 1539 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1540 | switch (tmp) { |
| 1541 | case 1: |
| 1542 | spec->init_amp = ALC_INIT_GPIO1; |
| 1543 | break; |
| 1544 | case 3: |
| 1545 | spec->init_amp = ALC_INIT_GPIO2; |
| 1546 | break; |
| 1547 | case 7: |
| 1548 | spec->init_amp = ALC_INIT_GPIO3; |
| 1549 | break; |
| 1550 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1551 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1552 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1553 | break; |
| 1554 | } |
| 1555 | |
| 1556 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1557 | * when the external headphone out jack is plugged" |
| 1558 | */ |
| 1559 | if (!(ass & 0x8000)) |
| 1560 | return 1; |
| 1561 | /* |
| 1562 | * 10~8 : Jack location |
| 1563 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1564 | * 14~13: Resvered |
| 1565 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1566 | * when the external headphone out jack is plugged" |
| 1567 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1568 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1569 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1570 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1571 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1572 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1573 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1574 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1575 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1576 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1577 | else if (tmp == 3) |
| 1578 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1579 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1580 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1581 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1582 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1583 | return 1; |
| 1584 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1585 | } |
| 1586 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1587 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1588 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1589 | return 1; |
| 1590 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1591 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1592 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1593 | hda_nid_t porta, hda_nid_t porte, |
| 1594 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1595 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1596 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1597 | struct alc_spec *spec = codec->spec; |
| 1598 | snd_printd("realtek: " |
| 1599 | "Enable default setup for auto mode as fallback\n"); |
| 1600 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1601 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1602 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1603 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1604 | } |
| 1605 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1606 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1607 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1608 | */ |
| 1609 | |
| 1610 | struct alc_pincfg { |
| 1611 | hda_nid_t nid; |
| 1612 | u32 val; |
| 1613 | }; |
| 1614 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1615 | struct alc_model_fixup { |
| 1616 | const int id; |
| 1617 | const char *name; |
| 1618 | }; |
| 1619 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1620 | struct alc_fixup { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1621 | int type; |
Takashi Iwai | 361fe6e | 2011-01-14 09:55:32 +0100 | [diff] [blame] | 1622 | bool chained; |
| 1623 | int chain_id; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1624 | union { |
| 1625 | unsigned int sku; |
| 1626 | const struct alc_pincfg *pins; |
| 1627 | const struct hda_verb *verbs; |
| 1628 | void (*func)(struct hda_codec *codec, |
| 1629 | const struct alc_fixup *fix, |
| 1630 | int action); |
| 1631 | } v; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1632 | }; |
| 1633 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1634 | enum { |
| 1635 | ALC_FIXUP_INVALID, |
| 1636 | ALC_FIXUP_SKU, |
| 1637 | ALC_FIXUP_PINS, |
| 1638 | ALC_FIXUP_VERBS, |
| 1639 | ALC_FIXUP_FUNC, |
| 1640 | }; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1641 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1642 | enum { |
| 1643 | ALC_FIXUP_ACT_PRE_PROBE, |
| 1644 | ALC_FIXUP_ACT_PROBE, |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 1645 | ALC_FIXUP_ACT_INIT, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1646 | }; |
| 1647 | |
| 1648 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1649 | { |
| 1650 | struct alc_spec *spec = codec->spec; |
| 1651 | int id = spec->fixup_id; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1652 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1653 | const char *modelname = spec->fixup_name; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1654 | #endif |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1655 | int depth = 0; |
| 1656 | |
| 1657 | if (!spec->fixup_list) |
| 1658 | return; |
| 1659 | |
| 1660 | while (id >= 0) { |
| 1661 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1662 | const struct alc_pincfg *cfg; |
| 1663 | |
| 1664 | switch (fix->type) { |
| 1665 | case ALC_FIXUP_SKU: |
| 1666 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1667 | break;; |
| 1668 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1669 | "Apply sku override for %s\n", |
| 1670 | codec->chip_name, modelname); |
| 1671 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1672 | spec->cdefine.fixup = 1; |
| 1673 | break; |
| 1674 | case ALC_FIXUP_PINS: |
| 1675 | cfg = fix->v.pins; |
| 1676 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1677 | break; |
| 1678 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1679 | "Apply pincfg for %s\n", |
| 1680 | codec->chip_name, modelname); |
| 1681 | for (; cfg->nid; cfg++) |
| 1682 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1683 | cfg->val); |
| 1684 | break; |
| 1685 | case ALC_FIXUP_VERBS: |
| 1686 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1687 | break; |
| 1688 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1689 | "Apply fix-verbs for %s\n", |
| 1690 | codec->chip_name, modelname); |
| 1691 | add_verb(codec->spec, fix->v.verbs); |
| 1692 | break; |
| 1693 | case ALC_FIXUP_FUNC: |
| 1694 | if (!fix->v.func) |
| 1695 | break; |
| 1696 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1697 | "Apply fix-func for %s\n", |
| 1698 | codec->chip_name, modelname); |
| 1699 | fix->v.func(codec, fix, action); |
| 1700 | break; |
| 1701 | default: |
| 1702 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1703 | "Invalid fixup type %d\n", |
| 1704 | codec->chip_name, fix->type); |
| 1705 | break; |
| 1706 | } |
| 1707 | if (!fix[id].chained) |
| 1708 | break; |
| 1709 | if (++depth > 10) |
| 1710 | break; |
| 1711 | id = fix[id].chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1712 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1713 | } |
| 1714 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1715 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1716 | const struct alc_model_fixup *models, |
| 1717 | const struct snd_pci_quirk *quirk, |
| 1718 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1719 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1720 | struct alc_spec *spec = codec->spec; |
| 1721 | int id = -1; |
| 1722 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1723 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1724 | if (codec->modelname && models) { |
| 1725 | while (models->name) { |
| 1726 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1727 | id = models->id; |
| 1728 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1729 | break; |
| 1730 | } |
| 1731 | models++; |
| 1732 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1733 | } |
| 1734 | if (id < 0) { |
| 1735 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1736 | if (quirk) { |
| 1737 | id = quirk->value; |
| 1738 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1739 | name = quirk->name; |
| 1740 | #endif |
| 1741 | } |
| 1742 | } |
| 1743 | |
| 1744 | spec->fixup_id = id; |
| 1745 | if (id >= 0) { |
| 1746 | spec->fixup_list = fixlist; |
| 1747 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1748 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1749 | } |
| 1750 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1751 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1752 | unsigned int coef_idx) |
| 1753 | { |
| 1754 | unsigned int val; |
| 1755 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1756 | coef_idx); |
| 1757 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1758 | AC_VERB_GET_PROC_COEF, 0); |
| 1759 | return val; |
| 1760 | } |
| 1761 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1762 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1763 | unsigned int coef_val) |
| 1764 | { |
| 1765 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1766 | coef_idx); |
| 1767 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1768 | coef_val); |
| 1769 | } |
| 1770 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1771 | /* set right pin controls for digital I/O */ |
| 1772 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1773 | { |
| 1774 | struct alc_spec *spec = codec->spec; |
| 1775 | int i; |
| 1776 | hda_nid_t pin; |
| 1777 | |
| 1778 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1779 | pin = spec->autocfg.dig_out_pins[i]; |
| 1780 | if (pin) { |
| 1781 | snd_hda_codec_write(codec, pin, 0, |
| 1782 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1783 | PIN_OUT); |
| 1784 | } |
| 1785 | } |
| 1786 | pin = spec->autocfg.dig_in_pin; |
| 1787 | if (pin) |
| 1788 | snd_hda_codec_write(codec, pin, 0, |
| 1789 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1790 | PIN_IN); |
| 1791 | } |
| 1792 | |
| 1793 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1794 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1795 | { |
| 1796 | struct alc_spec *spec = codec->spec; |
| 1797 | int i, err; |
| 1798 | hda_nid_t dig_nid; |
| 1799 | |
| 1800 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1801 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1802 | err = snd_hda_get_connections(codec, |
| 1803 | spec->autocfg.dig_out_pins[i], |
| 1804 | &dig_nid, 1); |
| 1805 | if (err < 0) |
| 1806 | continue; |
| 1807 | if (!i) { |
| 1808 | spec->multiout.dig_out_nid = dig_nid; |
| 1809 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1810 | } else { |
| 1811 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1812 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1813 | break; |
| 1814 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1815 | } |
| 1816 | } |
| 1817 | |
| 1818 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1819 | dig_nid = codec->start_nid; |
| 1820 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1821 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1822 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1823 | continue; |
| 1824 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1825 | continue; |
| 1826 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1827 | continue; |
| 1828 | err = get_connection_index(codec, dig_nid, |
| 1829 | spec->autocfg.dig_in_pin); |
| 1830 | if (err >= 0) { |
| 1831 | spec->dig_in_nid = dig_nid; |
| 1832 | break; |
| 1833 | } |
| 1834 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1835 | } |
| 1836 | } |
| 1837 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1838 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1839 | * ALC888 |
| 1840 | */ |
| 1841 | |
| 1842 | /* |
| 1843 | * 2ch mode |
| 1844 | */ |
| 1845 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1846 | /* Mic-in jack as mic in */ |
| 1847 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1848 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1849 | /* Line-in jack as Line in */ |
| 1850 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1851 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1852 | /* Line-Out as Front */ |
| 1853 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1854 | { } /* end */ |
| 1855 | }; |
| 1856 | |
| 1857 | /* |
| 1858 | * 4ch mode |
| 1859 | */ |
| 1860 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1861 | /* Mic-in jack as mic in */ |
| 1862 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1863 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1864 | /* Line-in jack as Surround */ |
| 1865 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1866 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1867 | /* Line-Out as Front */ |
| 1868 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1869 | { } /* end */ |
| 1870 | }; |
| 1871 | |
| 1872 | /* |
| 1873 | * 6ch mode |
| 1874 | */ |
| 1875 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1876 | /* Mic-in jack as CLFE */ |
| 1877 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1878 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1879 | /* Line-in jack as Surround */ |
| 1880 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1881 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1882 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1883 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1884 | { } /* end */ |
| 1885 | }; |
| 1886 | |
| 1887 | /* |
| 1888 | * 8ch mode |
| 1889 | */ |
| 1890 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1891 | /* Mic-in jack as CLFE */ |
| 1892 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1893 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1894 | /* Line-in jack as Surround */ |
| 1895 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1896 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1897 | /* Line-Out as Side */ |
| 1898 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1899 | { } /* end */ |
| 1900 | }; |
| 1901 | |
| 1902 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1903 | { 2, alc888_4ST_ch2_intel_init }, |
| 1904 | { 4, alc888_4ST_ch4_intel_init }, |
| 1905 | { 6, alc888_4ST_ch6_intel_init }, |
| 1906 | { 8, alc888_4ST_ch8_intel_init }, |
| 1907 | }; |
| 1908 | |
| 1909 | /* |
| 1910 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1911 | */ |
| 1912 | |
| 1913 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1914 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1915 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1916 | /* Connect Internal HP to Front */ |
| 1917 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1918 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1919 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1920 | /* Connect Bass HP to Front */ |
| 1921 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1922 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1923 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1924 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1925 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1926 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1927 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1928 | /* Connect Mic jack to CLFE */ |
| 1929 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1930 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1931 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1932 | /* Connect Line-in jack to Surround */ |
| 1933 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1934 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1935 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1936 | /* Connect HP out jack to Front */ |
| 1937 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1938 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1939 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1940 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1941 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1942 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1943 | {} |
| 1944 | }; |
| 1945 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1946 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1947 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1948 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1949 | } |
| 1950 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1951 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1952 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1953 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1954 | if (codec->vendor_id == 0x10ec0880) |
| 1955 | res >>= 28; |
| 1956 | else |
| 1957 | res >>= 26; |
| 1958 | if (res == ALC880_HP_EVENT) |
| 1959 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1960 | } |
| 1961 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1962 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1963 | { |
| 1964 | struct alc_spec *spec = codec->spec; |
| 1965 | |
| 1966 | spec->autocfg.hp_pins[0] = 0x15; |
| 1967 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1968 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1969 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1970 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1971 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1972 | } |
| 1973 | |
| 1974 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1975 | { |
| 1976 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1977 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1978 | } |
| 1979 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1980 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1981 | { |
| 1982 | struct alc_spec *spec = codec->spec; |
| 1983 | |
| 1984 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1985 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1986 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1987 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1988 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1989 | |
| 1990 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1991 | * ALC888 Acer Aspire 4930G model |
| 1992 | */ |
| 1993 | |
| 1994 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1995 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1996 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1997 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1998 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1999 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2000 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2001 | /* Connect Internal HP to front */ |
| 2002 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2003 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2004 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2005 | /* Connect HP out to front */ |
| 2006 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2007 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2008 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2009 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2010 | { } |
| 2011 | }; |
| 2012 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2013 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2014 | * ALC888 Acer Aspire 6530G model |
| 2015 | */ |
| 2016 | |
| 2017 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2018 | /* Route to built-in subwoofer as well as speakers */ |
| 2019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2021 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2022 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2023 | /* Bias voltage on for external mic port */ |
| 2024 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2025 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2026 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2027 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2028 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2029 | /* Enable unsolicited event for HP jack */ |
| 2030 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2031 | /* Enable speaker output */ |
| 2032 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2033 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2034 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2035 | /* Enable headphone output */ |
| 2036 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2038 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2039 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2040 | { } |
| 2041 | }; |
| 2042 | |
| 2043 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2044 | *ALC888 Acer Aspire 7730G model |
| 2045 | */ |
| 2046 | |
| 2047 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2048 | /* Bias voltage on for external mic port */ |
| 2049 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2050 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2051 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2052 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2053 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2054 | /* Enable unsolicited event for HP jack */ |
| 2055 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2056 | /* Enable speaker output */ |
| 2057 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2058 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2059 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2060 | /* Enable headphone output */ |
| 2061 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2062 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2063 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2064 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2065 | /*Enable internal subwoofer */ |
| 2066 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2067 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2068 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2069 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2070 | { } |
| 2071 | }; |
| 2072 | |
| 2073 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2074 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2075 | */ |
| 2076 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2077 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2078 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2079 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2080 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2082 | /* Enable unsolicited event for HP jack */ |
| 2083 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2084 | /* Connect Internal Front to Front */ |
| 2085 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2086 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2087 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2088 | /* Connect Internal Rear to Rear */ |
| 2089 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2090 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2091 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2092 | /* Connect Internal CLFE to CLFE */ |
| 2093 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2094 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2095 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2096 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2097 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2098 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2099 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2100 | /* Enable all DACs */ |
| 2101 | /* DAC DISABLE/MUTE 1? */ |
| 2102 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2103 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2104 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2105 | /* DAC DISABLE/MUTE 2? */ |
| 2106 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2107 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2108 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2109 | /* DMIC fix |
| 2110 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2111 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2112 | * makes the signal become a difference/sum signal instead of standard |
| 2113 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2114 | * codec replicate the sum signal to both channels, turning it into a |
| 2115 | * normal mono mic. |
| 2116 | */ |
| 2117 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2118 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2119 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2120 | { } |
| 2121 | }; |
| 2122 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2123 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2124 | /* Front mic only available on one ADC */ |
| 2125 | { |
| 2126 | .num_items = 4, |
| 2127 | .items = { |
| 2128 | { "Mic", 0x0 }, |
| 2129 | { "Line", 0x2 }, |
| 2130 | { "CD", 0x4 }, |
| 2131 | { "Front Mic", 0xb }, |
| 2132 | }, |
| 2133 | }, |
| 2134 | { |
| 2135 | .num_items = 3, |
| 2136 | .items = { |
| 2137 | { "Mic", 0x0 }, |
| 2138 | { "Line", 0x2 }, |
| 2139 | { "CD", 0x4 }, |
| 2140 | }, |
| 2141 | } |
| 2142 | }; |
| 2143 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2144 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2145 | /* Interal mic only available on one ADC */ |
| 2146 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2147 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2148 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2149 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2150 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2151 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2152 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2153 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2154 | }, |
| 2155 | }, |
| 2156 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2157 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2158 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2159 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2160 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2161 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2162 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2163 | }, |
| 2164 | } |
| 2165 | }; |
| 2166 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2167 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2168 | /* Digital mic only available on first "ADC" */ |
| 2169 | { |
| 2170 | .num_items = 5, |
| 2171 | .items = { |
| 2172 | { "Mic", 0x0 }, |
| 2173 | { "Line", 0x2 }, |
| 2174 | { "CD", 0x4 }, |
| 2175 | { "Front Mic", 0xb }, |
| 2176 | { "Input Mix", 0xa }, |
| 2177 | }, |
| 2178 | }, |
| 2179 | { |
| 2180 | .num_items = 4, |
| 2181 | .items = { |
| 2182 | { "Mic", 0x0 }, |
| 2183 | { "Line", 0x2 }, |
| 2184 | { "CD", 0x4 }, |
| 2185 | { "Input Mix", 0xa }, |
| 2186 | }, |
| 2187 | }, |
| 2188 | { |
| 2189 | .num_items = 4, |
| 2190 | .items = { |
| 2191 | { "Mic", 0x0 }, |
| 2192 | { "Line", 0x2 }, |
| 2193 | { "CD", 0x4 }, |
| 2194 | { "Input Mix", 0xa }, |
| 2195 | }, |
| 2196 | } |
| 2197 | }; |
| 2198 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2199 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2200 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2201 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2202 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2203 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2204 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2205 | HDA_OUTPUT), |
| 2206 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2207 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2208 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2209 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2210 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2211 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2212 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2213 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2214 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2216 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2217 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2218 | { } /* end */ |
| 2219 | }; |
| 2220 | |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2221 | static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { |
| 2222 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2223 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2224 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2225 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2226 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2227 | HDA_OUTPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2228 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2229 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2230 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2231 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
| 2232 | HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2233 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2234 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2235 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2236 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2237 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2238 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 2239 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2240 | { } /* end */ |
| 2241 | }; |
| 2242 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2243 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2244 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2245 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2246 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2247 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2248 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2249 | HDA_OUTPUT), |
| 2250 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2251 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2252 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2253 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2254 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2255 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2256 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2257 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2258 | { } /* end */ |
| 2259 | }; |
| 2260 | |
| 2261 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2262 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2263 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2264 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2265 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2266 | spec->autocfg.hp_pins[0] = 0x15; |
| 2267 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2268 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2269 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2270 | } |
| 2271 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2272 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2273 | { |
| 2274 | struct alc_spec *spec = codec->spec; |
| 2275 | |
| 2276 | spec->autocfg.hp_pins[0] = 0x15; |
| 2277 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2278 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2279 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2280 | } |
| 2281 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2282 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2283 | { |
| 2284 | struct alc_spec *spec = codec->spec; |
| 2285 | |
| 2286 | spec->autocfg.hp_pins[0] = 0x15; |
| 2287 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2288 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2289 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2290 | } |
| 2291 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2292 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2293 | { |
| 2294 | struct alc_spec *spec = codec->spec; |
| 2295 | |
| 2296 | spec->autocfg.hp_pins[0] = 0x15; |
| 2297 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2298 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2299 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2300 | } |
| 2301 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2302 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2303 | * ALC880 3-stack model |
| 2304 | * |
| 2305 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2306 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2307 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2308 | */ |
| 2309 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2310 | static hda_nid_t alc880_dac_nids[4] = { |
| 2311 | /* front, rear, clfe, rear_surr */ |
| 2312 | 0x02, 0x05, 0x04, 0x03 |
| 2313 | }; |
| 2314 | |
| 2315 | static hda_nid_t alc880_adc_nids[3] = { |
| 2316 | /* ADC0-2 */ |
| 2317 | 0x07, 0x08, 0x09, |
| 2318 | }; |
| 2319 | |
| 2320 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2321 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2322 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2323 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2324 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2325 | /* ADC1-2 */ |
| 2326 | 0x08, 0x09, |
| 2327 | }; |
| 2328 | |
| 2329 | #define ALC880_DIGOUT_NID 0x06 |
| 2330 | #define ALC880_DIGIN_NID 0x0a |
| 2331 | |
| 2332 | static struct hda_input_mux alc880_capture_source = { |
| 2333 | .num_items = 4, |
| 2334 | .items = { |
| 2335 | { "Mic", 0x0 }, |
| 2336 | { "Front Mic", 0x3 }, |
| 2337 | { "Line", 0x2 }, |
| 2338 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2339 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2340 | }; |
| 2341 | |
| 2342 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2343 | /* 2ch mode */ |
| 2344 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2345 | /* set line-in to input, mute it */ |
| 2346 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2347 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2348 | /* set mic-in to input vref 80%, mute it */ |
| 2349 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2350 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2351 | { } /* end */ |
| 2352 | }; |
| 2353 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2354 | /* 6ch mode */ |
| 2355 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2356 | /* set line-in to output, unmute it */ |
| 2357 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2358 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2359 | /* set mic-in to output, unmute it */ |
| 2360 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2361 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2362 | { } /* end */ |
| 2363 | }; |
| 2364 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2365 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2366 | { 2, alc880_threestack_ch2_init }, |
| 2367 | { 6, alc880_threestack_ch6_init }, |
| 2368 | }; |
| 2369 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2370 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2371 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2372 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2373 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2374 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2375 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2376 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2377 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2378 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2379 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2380 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2381 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2382 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2383 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2384 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2385 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2386 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2387 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2388 | { |
| 2389 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2390 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2391 | .info = alc_ch_mode_info, |
| 2392 | .get = alc_ch_mode_get, |
| 2393 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2394 | }, |
| 2395 | { } /* end */ |
| 2396 | }; |
| 2397 | |
| 2398 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2399 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2400 | struct snd_ctl_elem_info *uinfo) |
| 2401 | { |
| 2402 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2403 | struct alc_spec *spec = codec->spec; |
| 2404 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2405 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2406 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2407 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2408 | HDA_INPUT); |
| 2409 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2410 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2411 | return err; |
| 2412 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2413 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2414 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2415 | unsigned int size, unsigned int __user *tlv) |
| 2416 | { |
| 2417 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2418 | struct alc_spec *spec = codec->spec; |
| 2419 | int err; |
| 2420 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2421 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2422 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2423 | HDA_INPUT); |
| 2424 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2425 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2426 | return err; |
| 2427 | } |
| 2428 | |
| 2429 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2430 | struct snd_ctl_elem_value *ucontrol); |
| 2431 | |
| 2432 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2433 | struct snd_ctl_elem_value *ucontrol, |
| 2434 | getput_call_t func) |
| 2435 | { |
| 2436 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2437 | struct alc_spec *spec = codec->spec; |
| 2438 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2439 | int err; |
| 2440 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2441 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2442 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2443 | 3, 0, HDA_INPUT); |
| 2444 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2445 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2446 | return err; |
| 2447 | } |
| 2448 | |
| 2449 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2450 | struct snd_ctl_elem_value *ucontrol) |
| 2451 | { |
| 2452 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2453 | snd_hda_mixer_amp_volume_get); |
| 2454 | } |
| 2455 | |
| 2456 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2457 | struct snd_ctl_elem_value *ucontrol) |
| 2458 | { |
| 2459 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2460 | snd_hda_mixer_amp_volume_put); |
| 2461 | } |
| 2462 | |
| 2463 | /* capture mixer elements */ |
| 2464 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2465 | |
| 2466 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2467 | struct snd_ctl_elem_value *ucontrol) |
| 2468 | { |
| 2469 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2470 | snd_hda_mixer_amp_switch_get); |
| 2471 | } |
| 2472 | |
| 2473 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2474 | struct snd_ctl_elem_value *ucontrol) |
| 2475 | { |
| 2476 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2477 | snd_hda_mixer_amp_switch_put); |
| 2478 | } |
| 2479 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2480 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2481 | { \ |
| 2482 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2483 | .name = "Capture Switch", \ |
| 2484 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2485 | .count = num, \ |
| 2486 | .info = alc_cap_sw_info, \ |
| 2487 | .get = alc_cap_sw_get, \ |
| 2488 | .put = alc_cap_sw_put, \ |
| 2489 | }, \ |
| 2490 | { \ |
| 2491 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2492 | .name = "Capture Volume", \ |
| 2493 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2494 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2495 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2496 | .count = num, \ |
| 2497 | .info = alc_cap_vol_info, \ |
| 2498 | .get = alc_cap_vol_get, \ |
| 2499 | .put = alc_cap_vol_put, \ |
| 2500 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2501 | } |
| 2502 | |
| 2503 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2504 | { \ |
| 2505 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2506 | /* .name = "Capture Source", */ \ |
| 2507 | .name = "Input Source", \ |
| 2508 | .count = num, \ |
| 2509 | .info = alc_mux_enum_info, \ |
| 2510 | .get = alc_mux_enum_get, \ |
| 2511 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2512 | } |
| 2513 | |
| 2514 | #define DEFINE_CAPMIX(num) \ |
| 2515 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2516 | _DEFINE_CAPMIX(num), \ |
| 2517 | _DEFINE_CAPSRC(num), \ |
| 2518 | { } /* end */ \ |
| 2519 | } |
| 2520 | |
| 2521 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2522 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2523 | _DEFINE_CAPMIX(num), \ |
| 2524 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2525 | } |
| 2526 | |
| 2527 | /* up to three ADCs */ |
| 2528 | DEFINE_CAPMIX(1); |
| 2529 | DEFINE_CAPMIX(2); |
| 2530 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2531 | DEFINE_CAPMIX_NOSRC(1); |
| 2532 | DEFINE_CAPMIX_NOSRC(2); |
| 2533 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2534 | |
| 2535 | /* |
| 2536 | * ALC880 5-stack model |
| 2537 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2538 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2539 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2540 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2541 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2542 | */ |
| 2543 | |
| 2544 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2545 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2546 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2547 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2548 | { } /* end */ |
| 2549 | }; |
| 2550 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2551 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2552 | /* 6ch mode */ |
| 2553 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2554 | /* set line-in to input, mute it */ |
| 2555 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2556 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2557 | { } /* end */ |
| 2558 | }; |
| 2559 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2560 | /* 8ch mode */ |
| 2561 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2562 | /* set line-in to output, unmute it */ |
| 2563 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2564 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2565 | { } /* end */ |
| 2566 | }; |
| 2567 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2568 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2569 | { 6, alc880_fivestack_ch6_init }, |
| 2570 | { 8, alc880_fivestack_ch8_init }, |
| 2571 | }; |
| 2572 | |
| 2573 | |
| 2574 | /* |
| 2575 | * ALC880 6-stack model |
| 2576 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2577 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2578 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2579 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2580 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2581 | */ |
| 2582 | |
| 2583 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2584 | /* front, rear, clfe, rear_surr */ |
| 2585 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2586 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2587 | |
| 2588 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2589 | .num_items = 4, |
| 2590 | .items = { |
| 2591 | { "Mic", 0x0 }, |
| 2592 | { "Front Mic", 0x1 }, |
| 2593 | { "Line", 0x2 }, |
| 2594 | { "CD", 0x4 }, |
| 2595 | }, |
| 2596 | }; |
| 2597 | |
| 2598 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2599 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2600 | { 8, NULL }, |
| 2601 | }; |
| 2602 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2603 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2604 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2605 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2606 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2607 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2608 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2609 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2610 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2611 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2612 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2613 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2614 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2615 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2616 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2617 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2618 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2620 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2621 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2622 | { |
| 2623 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2624 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2625 | .info = alc_ch_mode_info, |
| 2626 | .get = alc_ch_mode_get, |
| 2627 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2628 | }, |
| 2629 | { } /* end */ |
| 2630 | }; |
| 2631 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2632 | |
| 2633 | /* |
| 2634 | * ALC880 W810 model |
| 2635 | * |
| 2636 | * W810 has rear IO for: |
| 2637 | * Front (DAC 02) |
| 2638 | * Surround (DAC 03) |
| 2639 | * Center/LFE (DAC 04) |
| 2640 | * Digital out (06) |
| 2641 | * |
| 2642 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2643 | * 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] | 2644 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2645 | * There is a variable resistor to control the speaker or headphone |
| 2646 | * volume. This is a hardware-only device without a software API. |
| 2647 | * |
| 2648 | * Plugging headphones in will disable the internal speakers. This is |
| 2649 | * implemented in hardware, not via the driver using jack sense. In |
| 2650 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2651 | * disable both the speakers and headphones. |
| 2652 | * |
| 2653 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2654 | * These may not do anything useful with this driver yet, because I |
| 2655 | * haven't setup any initialization verbs for these yet... |
| 2656 | */ |
| 2657 | |
| 2658 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2659 | /* front, rear/surround, clfe */ |
| 2660 | 0x02, 0x03, 0x04 |
| 2661 | }; |
| 2662 | |
| 2663 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2664 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2665 | { 6, NULL } |
| 2666 | }; |
| 2667 | |
| 2668 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2669 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2670 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2671 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2672 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2673 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2674 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2675 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2676 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2677 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2678 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2679 | { } /* end */ |
| 2680 | }; |
| 2681 | |
| 2682 | |
| 2683 | /* |
| 2684 | * Z710V model |
| 2685 | * |
| 2686 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2687 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2688 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2689 | */ |
| 2690 | |
| 2691 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2692 | 0x02 |
| 2693 | }; |
| 2694 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2695 | |
| 2696 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2697 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2698 | { 2, NULL } |
| 2699 | }; |
| 2700 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2701 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2702 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2703 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2704 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2705 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2706 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2707 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2708 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2709 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2710 | { } /* end */ |
| 2711 | }; |
| 2712 | |
| 2713 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2714 | /* |
| 2715 | * ALC880 F1734 model |
| 2716 | * |
| 2717 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2718 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2719 | */ |
| 2720 | |
| 2721 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2722 | 0x03 |
| 2723 | }; |
| 2724 | #define ALC880_F1734_HP_DAC 0x02 |
| 2725 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2726 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2727 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2728 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2729 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2730 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2731 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2732 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2733 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2734 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2735 | { } /* end */ |
| 2736 | }; |
| 2737 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2738 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2739 | .num_items = 2, |
| 2740 | .items = { |
| 2741 | { "Mic", 0x1 }, |
| 2742 | { "CD", 0x4 }, |
| 2743 | }, |
| 2744 | }; |
| 2745 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2746 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2747 | /* |
| 2748 | * ALC880 ASUS model |
| 2749 | * |
| 2750 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2751 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2752 | * Mic = 0x18, Line = 0x1a |
| 2753 | */ |
| 2754 | |
| 2755 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2756 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2757 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2758 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2759 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2760 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2761 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2762 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2763 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2764 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2765 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2766 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2767 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2768 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2769 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2770 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2771 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2772 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2773 | { |
| 2774 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2775 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2776 | .info = alc_ch_mode_info, |
| 2777 | .get = alc_ch_mode_get, |
| 2778 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2779 | }, |
| 2780 | { } /* end */ |
| 2781 | }; |
| 2782 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2783 | /* |
| 2784 | * ALC880 ASUS W1V model |
| 2785 | * |
| 2786 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2787 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2788 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2789 | */ |
| 2790 | |
| 2791 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2792 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2793 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2794 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2795 | { } /* end */ |
| 2796 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2797 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2798 | /* TCL S700 */ |
| 2799 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2800 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2801 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2802 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2803 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2804 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2805 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2807 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2808 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2809 | { } /* end */ |
| 2810 | }; |
| 2811 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2812 | /* Uniwill */ |
| 2813 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2814 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2815 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2816 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2817 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2818 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2819 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2820 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2821 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2822 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2823 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2824 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2825 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2826 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2827 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2828 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2829 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2830 | { |
| 2831 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2832 | .name = "Channel Mode", |
| 2833 | .info = alc_ch_mode_info, |
| 2834 | .get = alc_ch_mode_get, |
| 2835 | .put = alc_ch_mode_put, |
| 2836 | }, |
| 2837 | { } /* end */ |
| 2838 | }; |
| 2839 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2840 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2841 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2842 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2843 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2844 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2845 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2846 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2847 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2848 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2849 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2850 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2851 | { } /* end */ |
| 2852 | }; |
| 2853 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2854 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2855 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2856 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2857 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2858 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2859 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2860 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2861 | { } /* end */ |
| 2862 | }; |
| 2863 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2864 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2865 | * virtual master controls |
| 2866 | */ |
| 2867 | |
| 2868 | /* |
| 2869 | * slave controls for virtual master |
| 2870 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2871 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2872 | "Front Playback Volume", |
| 2873 | "Surround Playback Volume", |
| 2874 | "Center Playback Volume", |
| 2875 | "LFE Playback Volume", |
| 2876 | "Side Playback Volume", |
| 2877 | "Headphone Playback Volume", |
| 2878 | "Speaker Playback Volume", |
| 2879 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2880 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2881 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2882 | NULL, |
| 2883 | }; |
| 2884 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2885 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2886 | "Front Playback Switch", |
| 2887 | "Surround Playback Switch", |
| 2888 | "Center Playback Switch", |
| 2889 | "LFE Playback Switch", |
| 2890 | "Side Playback Switch", |
| 2891 | "Headphone Playback Switch", |
| 2892 | "Speaker Playback Switch", |
| 2893 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2894 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2895 | "Line-Out Playback Switch", |
| 2896 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2897 | NULL, |
| 2898 | }; |
| 2899 | |
| 2900 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2901 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2902 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2903 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2904 | #define NID_MAPPING (-1) |
| 2905 | |
| 2906 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2907 | #define SUBDEV_HP_ (1 << 6) |
| 2908 | #define SUBDEV_LINE_ (2 << 6) |
| 2909 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2910 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2911 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2912 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2913 | static void alc_free_kctls(struct hda_codec *codec); |
| 2914 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2915 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2916 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2917 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2918 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2919 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2920 | { } /* end */ |
| 2921 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2922 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2923 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2924 | static int alc_build_controls(struct hda_codec *codec) |
| 2925 | { |
| 2926 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2927 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2928 | struct snd_kcontrol_new *knew; |
| 2929 | int i, j, err; |
| 2930 | unsigned int u; |
| 2931 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2932 | |
| 2933 | for (i = 0; i < spec->num_mixers; i++) { |
| 2934 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2935 | if (err < 0) |
| 2936 | return err; |
| 2937 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2938 | if (spec->cap_mixer) { |
| 2939 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2940 | if (err < 0) |
| 2941 | return err; |
| 2942 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2943 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2944 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2945 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2946 | if (err < 0) |
| 2947 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2948 | if (!spec->no_analog) { |
| 2949 | err = snd_hda_create_spdif_share_sw(codec, |
| 2950 | &spec->multiout); |
| 2951 | if (err < 0) |
| 2952 | return err; |
| 2953 | spec->multiout.share_spdif = 1; |
| 2954 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2955 | } |
| 2956 | if (spec->dig_in_nid) { |
| 2957 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2958 | if (err < 0) |
| 2959 | return err; |
| 2960 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2961 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2962 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2963 | /* create beep controls if needed */ |
| 2964 | if (spec->beep_amp) { |
| 2965 | struct snd_kcontrol_new *knew; |
| 2966 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2967 | struct snd_kcontrol *kctl; |
| 2968 | kctl = snd_ctl_new1(knew, codec); |
| 2969 | if (!kctl) |
| 2970 | return -ENOMEM; |
| 2971 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2972 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2973 | if (err < 0) |
| 2974 | return err; |
| 2975 | } |
| 2976 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2977 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2978 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2979 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2980 | if (!spec->no_analog && |
| 2981 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2982 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2983 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2984 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2985 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2986 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2987 | if (err < 0) |
| 2988 | return err; |
| 2989 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2990 | if (!spec->no_analog && |
| 2991 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2992 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2993 | NULL, alc_slave_sws); |
| 2994 | if (err < 0) |
| 2995 | return err; |
| 2996 | } |
| 2997 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2998 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2999 | if (spec->capsrc_nids || spec->adc_nids) { |
| 3000 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 3001 | if (!kctl) |
| 3002 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3003 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3004 | hda_nid_t *nids = spec->capsrc_nids; |
| 3005 | if (!nids) |
| 3006 | nids = spec->adc_nids; |
| 3007 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3008 | if (err < 0) |
| 3009 | return err; |
| 3010 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3011 | } |
| 3012 | if (spec->cap_mixer) { |
| 3013 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3014 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3015 | if (kname && strcmp(knew->name, kname) == 0) |
| 3016 | continue; |
| 3017 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3018 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3019 | err = snd_hda_add_nid(codec, kctl, i, |
| 3020 | spec->adc_nids[i]); |
| 3021 | if (err < 0) |
| 3022 | return err; |
| 3023 | } |
| 3024 | } |
| 3025 | } |
| 3026 | |
| 3027 | /* other nid->control mapping */ |
| 3028 | for (i = 0; i < spec->num_mixers; i++) { |
| 3029 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3030 | if (knew->iface != NID_MAPPING) |
| 3031 | continue; |
| 3032 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3033 | if (kctl == NULL) |
| 3034 | continue; |
| 3035 | u = knew->subdevice; |
| 3036 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3037 | nid = u & 0x3f; |
| 3038 | if (nid == 0) |
| 3039 | continue; |
| 3040 | switch (u & 0xc0) { |
| 3041 | case SUBDEV_SPEAKER_: |
| 3042 | nid = spec->autocfg.speaker_pins[nid]; |
| 3043 | break; |
| 3044 | case SUBDEV_LINE_: |
| 3045 | nid = spec->autocfg.line_out_pins[nid]; |
| 3046 | break; |
| 3047 | case SUBDEV_HP_: |
| 3048 | nid = spec->autocfg.hp_pins[nid]; |
| 3049 | break; |
| 3050 | default: |
| 3051 | continue; |
| 3052 | } |
| 3053 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3054 | if (err < 0) |
| 3055 | return err; |
| 3056 | } |
| 3057 | u = knew->private_value; |
| 3058 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3059 | nid = u & 0xff; |
| 3060 | if (nid == 0) |
| 3061 | continue; |
| 3062 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3063 | if (err < 0) |
| 3064 | return err; |
| 3065 | } |
| 3066 | } |
| 3067 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3068 | |
| 3069 | alc_free_kctls(codec); /* no longer needed */ |
| 3070 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3071 | return 0; |
| 3072 | } |
| 3073 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3074 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3075 | /* |
| 3076 | * initialize the codec volumes, etc |
| 3077 | */ |
| 3078 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3079 | /* |
| 3080 | * generic initialization of ADC, input mixers and output mixers |
| 3081 | */ |
| 3082 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3083 | /* |
| 3084 | * Unmute ADC0-2 and set the default input to mic-in |
| 3085 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3086 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3087 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3088 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3089 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3090 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3091 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3092 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3093 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3094 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3095 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3096 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3097 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3098 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3103 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3104 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3105 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3106 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3107 | /* |
| 3108 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3109 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3110 | /* set vol=0 to output mixers */ |
| 3111 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3112 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3113 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3114 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3115 | /* set up input amps for analog loopback */ |
| 3116 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3117 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3118 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3119 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3120 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3121 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3122 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3123 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3124 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3125 | |
| 3126 | { } |
| 3127 | }; |
| 3128 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3129 | /* |
| 3130 | * 3-stack pin configuration: |
| 3131 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3132 | */ |
| 3133 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3134 | /* |
| 3135 | * preset connection lists of input pins |
| 3136 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3137 | */ |
| 3138 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3139 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3140 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3141 | |
| 3142 | /* |
| 3143 | * Set pin mode and muting |
| 3144 | */ |
| 3145 | /* set front pin widgets 0x14 for output */ |
| 3146 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3147 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3148 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3149 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3150 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3151 | /* Mic2 (as headphone out) for HP output */ |
| 3152 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3153 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3154 | /* Line In pin widget for input */ |
| 3155 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3156 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3157 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3158 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3159 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3160 | /* CD pin widget for input */ |
| 3161 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3162 | |
| 3163 | { } |
| 3164 | }; |
| 3165 | |
| 3166 | /* |
| 3167 | * 5-stack pin configuration: |
| 3168 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3169 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3170 | */ |
| 3171 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3172 | /* |
| 3173 | * preset connection lists of input pins |
| 3174 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3175 | */ |
| 3176 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3177 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3178 | |
| 3179 | /* |
| 3180 | * Set pin mode and muting |
| 3181 | */ |
| 3182 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3183 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3184 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3185 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3186 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3187 | /* unmute pins for output (no gain on this amp) */ |
| 3188 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3189 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3190 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3191 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3192 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3193 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3194 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3195 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3196 | /* Mic2 (as headphone out) for HP output */ |
| 3197 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3198 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3199 | /* Line In pin widget for input */ |
| 3200 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3201 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3202 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3203 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3204 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3205 | /* CD pin widget for input */ |
| 3206 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3207 | |
| 3208 | { } |
| 3209 | }; |
| 3210 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3211 | /* |
| 3212 | * W810 pin configuration: |
| 3213 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3214 | */ |
| 3215 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3216 | /* hphone/speaker input selector: front DAC */ |
| 3217 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3218 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3219 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3220 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3221 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3222 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3223 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3224 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3225 | |
| 3226 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3227 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3228 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3229 | { } |
| 3230 | }; |
| 3231 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3232 | /* |
| 3233 | * Z71V pin configuration: |
| 3234 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3235 | */ |
| 3236 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3237 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3238 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3239 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3240 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3241 | |
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 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3244 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3245 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3246 | |
| 3247 | { } |
| 3248 | }; |
| 3249 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3250 | /* |
| 3251 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3252 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3253 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3254 | */ |
| 3255 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3256 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3257 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3258 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3259 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3260 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3261 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3262 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3263 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3264 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3265 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3266 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3267 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3268 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3269 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3270 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3272 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3273 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3274 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3275 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3276 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3277 | { } |
| 3278 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3279 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3280 | /* |
| 3281 | * Uniwill pin configuration: |
| 3282 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3283 | * line = 0x1a |
| 3284 | */ |
| 3285 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3286 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3287 | |
| 3288 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3289 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3290 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3291 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3292 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3293 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3294 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3295 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3296 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3297 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3298 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3299 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3300 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3301 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3302 | |
| 3303 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3304 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3305 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3306 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3307 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3308 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3309 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3310 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3311 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3312 | |
| 3313 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3314 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3315 | |
| 3316 | { } |
| 3317 | }; |
| 3318 | |
| 3319 | /* |
| 3320 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3321 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3322 | */ |
| 3323 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3324 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3325 | |
| 3326 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3327 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3328 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3329 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3330 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3331 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3332 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3333 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3334 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3335 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3336 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3337 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3338 | |
| 3339 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3340 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3341 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3342 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3343 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3344 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3345 | |
| 3346 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3347 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3348 | |
| 3349 | { } |
| 3350 | }; |
| 3351 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3352 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3353 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3354 | { } |
| 3355 | }; |
| 3356 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3357 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3358 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3359 | { |
| 3360 | unsigned int present; |
| 3361 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3362 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3363 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3364 | bits = present ? HDA_AMP_MUTE : 0; |
| 3365 | 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] | 3366 | } |
| 3367 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3368 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3369 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3370 | struct alc_spec *spec = codec->spec; |
| 3371 | |
| 3372 | spec->autocfg.hp_pins[0] = 0x14; |
| 3373 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3374 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3375 | } |
| 3376 | |
| 3377 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3378 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3379 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3380 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3381 | } |
| 3382 | |
| 3383 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3384 | unsigned int res) |
| 3385 | { |
| 3386 | /* Looks like the unsol event is incompatible with the standard |
| 3387 | * definition. 4bit tag is placed at 28 bit! |
| 3388 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3389 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3390 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3391 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3392 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3393 | default: |
| 3394 | alc_automute_amp_unsol_event(codec, res); |
| 3395 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3396 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3397 | } |
| 3398 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3399 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3400 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3401 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3402 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3403 | spec->autocfg.hp_pins[0] = 0x14; |
| 3404 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3405 | } |
| 3406 | |
| 3407 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3408 | { |
| 3409 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3410 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3411 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3412 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3413 | present &= HDA_AMP_VOLMASK; |
| 3414 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3415 | HDA_AMP_VOLMASK, present); |
| 3416 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3417 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3418 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3419 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3420 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3421 | unsigned int res) |
| 3422 | { |
| 3423 | /* Looks like the unsol event is incompatible with the standard |
| 3424 | * definition. 4bit tag is placed at 28 bit! |
| 3425 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3426 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3427 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3428 | else |
| 3429 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3430 | } |
| 3431 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3432 | /* |
| 3433 | * F1734 pin configuration: |
| 3434 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3435 | */ |
| 3436 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3437 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3438 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3439 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3440 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3441 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3442 | |
| 3443 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3444 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3445 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3446 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3447 | |
| 3448 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3449 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3450 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3451 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3452 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3453 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3454 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3455 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3456 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3457 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3458 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3459 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3460 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3461 | { } |
| 3462 | }; |
| 3463 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3464 | /* |
| 3465 | * ASUS pin configuration: |
| 3466 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3467 | */ |
| 3468 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3469 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3470 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3471 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3472 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3473 | |
| 3474 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3475 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3476 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3477 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3478 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3479 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3480 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3481 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3482 | |
| 3483 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3484 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3485 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3486 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3487 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3488 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3489 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3490 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3491 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3492 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3493 | { } |
| 3494 | }; |
| 3495 | |
| 3496 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3497 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3498 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3499 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3500 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3501 | /* Clevo m520g init */ |
| 3502 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3503 | /* headphone output */ |
| 3504 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3505 | /* line-out */ |
| 3506 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3507 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3508 | /* Line-in */ |
| 3509 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3510 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3511 | /* CD */ |
| 3512 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3513 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3514 | /* Mic1 (rear panel) */ |
| 3515 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3516 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3517 | /* Mic2 (front panel) */ |
| 3518 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3519 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3520 | /* headphone */ |
| 3521 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3522 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3523 | /* change to EAPD mode */ |
| 3524 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3525 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3526 | |
| 3527 | { } |
| 3528 | }; |
| 3529 | |
| 3530 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3531 | /* change to EAPD mode */ |
| 3532 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3533 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3534 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3535 | /* Headphone output */ |
| 3536 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3537 | /* Front output*/ |
| 3538 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3539 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3540 | |
| 3541 | /* Line In pin widget for input */ |
| 3542 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3543 | /* CD pin widget for input */ |
| 3544 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3545 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3546 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3547 | |
| 3548 | /* change to EAPD mode */ |
| 3549 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3550 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3551 | |
| 3552 | { } |
| 3553 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3554 | |
| 3555 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3556 | * LG m1 express dual |
| 3557 | * |
| 3558 | * Pin assignment: |
| 3559 | * Rear Line-In/Out (blue): 0x14 |
| 3560 | * Build-in Mic-In: 0x15 |
| 3561 | * Speaker-out: 0x17 |
| 3562 | * HP-Out (green): 0x1b |
| 3563 | * Mic-In/Out (red): 0x19 |
| 3564 | * SPDIF-Out: 0x1e |
| 3565 | */ |
| 3566 | |
| 3567 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3568 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3569 | 0x05, 0x02, 0x03 |
| 3570 | }; |
| 3571 | |
| 3572 | /* seems analog CD is not working */ |
| 3573 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3574 | .num_items = 3, |
| 3575 | .items = { |
| 3576 | { "Mic", 0x1 }, |
| 3577 | { "Line", 0x5 }, |
| 3578 | { "Internal Mic", 0x6 }, |
| 3579 | }, |
| 3580 | }; |
| 3581 | |
| 3582 | /* 2,4,6 channel modes */ |
| 3583 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3584 | /* set line-in and mic-in to input */ |
| 3585 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3586 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3587 | { } |
| 3588 | }; |
| 3589 | |
| 3590 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3591 | /* set line-in to out and mic-in to input */ |
| 3592 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3593 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3594 | { } |
| 3595 | }; |
| 3596 | |
| 3597 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3598 | /* set line-in and mic-in to output */ |
| 3599 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3600 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3601 | { } |
| 3602 | }; |
| 3603 | |
| 3604 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3605 | { 2, alc880_lg_ch2_init }, |
| 3606 | { 4, alc880_lg_ch4_init }, |
| 3607 | { 6, alc880_lg_ch6_init }, |
| 3608 | }; |
| 3609 | |
| 3610 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3611 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3612 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3613 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3614 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3615 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3616 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3617 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3618 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3619 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3620 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3621 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3622 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3623 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3624 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3625 | { |
| 3626 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3627 | .name = "Channel Mode", |
| 3628 | .info = alc_ch_mode_info, |
| 3629 | .get = alc_ch_mode_get, |
| 3630 | .put = alc_ch_mode_put, |
| 3631 | }, |
| 3632 | { } /* end */ |
| 3633 | }; |
| 3634 | |
| 3635 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3636 | /* set capture source to mic-in */ |
| 3637 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3638 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3639 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3640 | /* mute all amp mixer inputs */ |
| 3641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3642 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3643 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3644 | /* line-in to input */ |
| 3645 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3646 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3647 | /* built-in mic */ |
| 3648 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3649 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3650 | /* speaker-out */ |
| 3651 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3652 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3653 | /* mic-in to input */ |
| 3654 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3655 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3656 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3657 | /* HP-out */ |
| 3658 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3659 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3660 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3661 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3662 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3663 | { } |
| 3664 | }; |
| 3665 | |
| 3666 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3667 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3668 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3669 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3670 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3671 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3672 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3673 | } |
| 3674 | |
| 3675 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3676 | * LG LW20 |
| 3677 | * |
| 3678 | * Pin assignment: |
| 3679 | * Speaker-out: 0x14 |
| 3680 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3681 | * Built-in Mic-In: 0x19 |
| 3682 | * Line-In: 0x1b |
| 3683 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3684 | * SPDIF-Out: 0x1e |
| 3685 | */ |
| 3686 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3687 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3688 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3689 | .items = { |
| 3690 | { "Mic", 0x0 }, |
| 3691 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3692 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3693 | }, |
| 3694 | }; |
| 3695 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3696 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3697 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3698 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3699 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3700 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3701 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3702 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3703 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3704 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3705 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3706 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3707 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3708 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3709 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3710 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3711 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3712 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3713 | { |
| 3714 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3715 | .name = "Channel Mode", |
| 3716 | .info = alc_ch_mode_info, |
| 3717 | .get = alc_ch_mode_get, |
| 3718 | .put = alc_ch_mode_put, |
| 3719 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3720 | { } /* end */ |
| 3721 | }; |
| 3722 | |
| 3723 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3724 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3725 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3726 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3727 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3728 | /* set capture source to mic-in */ |
| 3729 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3730 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3731 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3732 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3733 | /* speaker-out */ |
| 3734 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3735 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3736 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3737 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3738 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3739 | /* mic-in to input */ |
| 3740 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3741 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3742 | /* built-in mic */ |
| 3743 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3744 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3745 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3746 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3747 | { } |
| 3748 | }; |
| 3749 | |
| 3750 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3751 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3752 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3753 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3754 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3755 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3756 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3757 | } |
| 3758 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3759 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3760 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3761 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3762 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3763 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3764 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3765 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3766 | { } /* end */ |
| 3767 | }; |
| 3768 | |
| 3769 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3770 | .num_items = 2, |
| 3771 | .items = { |
| 3772 | { "Mic", 0x0 }, |
| 3773 | { "Internal Mic", 0x1 }, |
| 3774 | }, |
| 3775 | }; |
| 3776 | |
| 3777 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3778 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3779 | |
| 3780 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3781 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3782 | |
| 3783 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3784 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3785 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3786 | /* Mic2 (as headphone out) for HP output */ |
| 3787 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3788 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3789 | /* Internal Speaker */ |
| 3790 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3791 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3792 | |
| 3793 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3794 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3795 | |
| 3796 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3797 | { } |
| 3798 | }; |
| 3799 | |
| 3800 | /* toggle speaker-output according to the hp-jack state */ |
| 3801 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3802 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3803 | struct alc_spec *spec = codec->spec; |
| 3804 | alc_automute_amp(codec); |
| 3805 | /* toggle EAPD */ |
| 3806 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3807 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3808 | else |
| 3809 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3810 | } |
| 3811 | |
| 3812 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3813 | unsigned int res) |
| 3814 | { |
| 3815 | /* Looks like the unsol event is incompatible with the standard |
| 3816 | * definition. 4bit tag is placed at 28 bit! |
| 3817 | */ |
| 3818 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3819 | alc880_medion_rim_automute(codec); |
| 3820 | } |
| 3821 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3822 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3823 | { |
| 3824 | struct alc_spec *spec = codec->spec; |
| 3825 | |
| 3826 | spec->autocfg.hp_pins[0] = 0x14; |
| 3827 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3828 | } |
| 3829 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3830 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3831 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3832 | { 0x0b, HDA_INPUT, 0 }, |
| 3833 | { 0x0b, HDA_INPUT, 1 }, |
| 3834 | { 0x0b, HDA_INPUT, 2 }, |
| 3835 | { 0x0b, HDA_INPUT, 3 }, |
| 3836 | { 0x0b, HDA_INPUT, 4 }, |
| 3837 | { } /* end */ |
| 3838 | }; |
| 3839 | |
| 3840 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3841 | { 0x0b, HDA_INPUT, 1 }, |
| 3842 | { 0x0b, HDA_INPUT, 6 }, |
| 3843 | { 0x0b, HDA_INPUT, 7 }, |
| 3844 | { } /* end */ |
| 3845 | }; |
| 3846 | #endif |
| 3847 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3848 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3849 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3850 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3851 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 3852 | static void alc_init_special_input_src(struct hda_codec *codec); |
| 3853 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3854 | static int alc_init(struct hda_codec *codec) |
| 3855 | { |
| 3856 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3857 | unsigned int i; |
| 3858 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3859 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3860 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3861 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3862 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3863 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 3864 | alc_init_special_input_src(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3865 | |
| 3866 | if (spec->init_hook) |
| 3867 | spec->init_hook(codec); |
| 3868 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 3869 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 3870 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3871 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3872 | return 0; |
| 3873 | } |
| 3874 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3875 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3876 | { |
| 3877 | struct alc_spec *spec = codec->spec; |
| 3878 | |
| 3879 | if (spec->unsol_event) |
| 3880 | spec->unsol_event(codec, res); |
| 3881 | } |
| 3882 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3883 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3884 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3885 | { |
| 3886 | struct alc_spec *spec = codec->spec; |
| 3887 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3888 | } |
| 3889 | #endif |
| 3890 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3891 | /* |
| 3892 | * Analog playback callbacks |
| 3893 | */ |
| 3894 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3895 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3896 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3897 | { |
| 3898 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3899 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3900 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3901 | } |
| 3902 | |
| 3903 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3904 | struct hda_codec *codec, |
| 3905 | unsigned int stream_tag, |
| 3906 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3907 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3908 | { |
| 3909 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3910 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3911 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3912 | } |
| 3913 | |
| 3914 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3915 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3916 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3917 | { |
| 3918 | struct alc_spec *spec = codec->spec; |
| 3919 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3920 | } |
| 3921 | |
| 3922 | /* |
| 3923 | * Digital out |
| 3924 | */ |
| 3925 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3926 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3927 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3928 | { |
| 3929 | struct alc_spec *spec = codec->spec; |
| 3930 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3931 | } |
| 3932 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3933 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3934 | struct hda_codec *codec, |
| 3935 | unsigned int stream_tag, |
| 3936 | unsigned int format, |
| 3937 | struct snd_pcm_substream *substream) |
| 3938 | { |
| 3939 | struct alc_spec *spec = codec->spec; |
| 3940 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3941 | stream_tag, format, substream); |
| 3942 | } |
| 3943 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3944 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3945 | struct hda_codec *codec, |
| 3946 | struct snd_pcm_substream *substream) |
| 3947 | { |
| 3948 | struct alc_spec *spec = codec->spec; |
| 3949 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3950 | } |
| 3951 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3952 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3953 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3954 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3955 | { |
| 3956 | struct alc_spec *spec = codec->spec; |
| 3957 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3958 | } |
| 3959 | |
| 3960 | /* |
| 3961 | * Analog capture |
| 3962 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3963 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3964 | struct hda_codec *codec, |
| 3965 | unsigned int stream_tag, |
| 3966 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3967 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3968 | { |
| 3969 | struct alc_spec *spec = codec->spec; |
| 3970 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3971 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3972 | stream_tag, 0, format); |
| 3973 | return 0; |
| 3974 | } |
| 3975 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3976 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3977 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3978 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3979 | { |
| 3980 | struct alc_spec *spec = codec->spec; |
| 3981 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3982 | snd_hda_codec_cleanup_stream(codec, |
| 3983 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3984 | return 0; |
| 3985 | } |
| 3986 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 3987 | /* analog capture with dynamic dual-adc changes */ |
| 3988 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3989 | struct hda_codec *codec, |
| 3990 | unsigned int stream_tag, |
| 3991 | unsigned int format, |
| 3992 | struct snd_pcm_substream *substream) |
| 3993 | { |
| 3994 | struct alc_spec *spec = codec->spec; |
| 3995 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3996 | spec->cur_adc_stream_tag = stream_tag; |
| 3997 | spec->cur_adc_format = format; |
| 3998 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3999 | return 0; |
| 4000 | } |
| 4001 | |
| 4002 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4003 | struct hda_codec *codec, |
| 4004 | struct snd_pcm_substream *substream) |
| 4005 | { |
| 4006 | struct alc_spec *spec = codec->spec; |
| 4007 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4008 | spec->cur_adc = 0; |
| 4009 | return 0; |
| 4010 | } |
| 4011 | |
| 4012 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4013 | .substreams = 1, |
| 4014 | .channels_min = 2, |
| 4015 | .channels_max = 2, |
| 4016 | .nid = 0, /* fill later */ |
| 4017 | .ops = { |
| 4018 | .prepare = dualmic_capture_pcm_prepare, |
| 4019 | .cleanup = dualmic_capture_pcm_cleanup |
| 4020 | }, |
| 4021 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4022 | |
| 4023 | /* |
| 4024 | */ |
| 4025 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4026 | .substreams = 1, |
| 4027 | .channels_min = 2, |
| 4028 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4029 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4030 | .ops = { |
| 4031 | .open = alc880_playback_pcm_open, |
| 4032 | .prepare = alc880_playback_pcm_prepare, |
| 4033 | .cleanup = alc880_playback_pcm_cleanup |
| 4034 | }, |
| 4035 | }; |
| 4036 | |
| 4037 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4038 | .substreams = 1, |
| 4039 | .channels_min = 2, |
| 4040 | .channels_max = 2, |
| 4041 | /* NID is set in alc_build_pcms */ |
| 4042 | }; |
| 4043 | |
| 4044 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 4045 | .substreams = 1, |
| 4046 | .channels_min = 2, |
| 4047 | .channels_max = 2, |
| 4048 | /* NID is set in alc_build_pcms */ |
| 4049 | }; |
| 4050 | |
| 4051 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 4052 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4053 | .channels_min = 2, |
| 4054 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4055 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4056 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4057 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4058 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4059 | }, |
| 4060 | }; |
| 4061 | |
| 4062 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4063 | .substreams = 1, |
| 4064 | .channels_min = 2, |
| 4065 | .channels_max = 2, |
| 4066 | /* NID is set in alc_build_pcms */ |
| 4067 | .ops = { |
| 4068 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4069 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4070 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4071 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4072 | }, |
| 4073 | }; |
| 4074 | |
| 4075 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4076 | .substreams = 1, |
| 4077 | .channels_min = 2, |
| 4078 | .channels_max = 2, |
| 4079 | /* NID is set in alc_build_pcms */ |
| 4080 | }; |
| 4081 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4082 | /* 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] | 4083 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4084 | .substreams = 0, |
| 4085 | .channels_min = 0, |
| 4086 | .channels_max = 0, |
| 4087 | }; |
| 4088 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4089 | static int alc_build_pcms(struct hda_codec *codec) |
| 4090 | { |
| 4091 | struct alc_spec *spec = codec->spec; |
| 4092 | struct hda_pcm *info = spec->pcm_rec; |
| 4093 | int i; |
| 4094 | |
| 4095 | codec->num_pcms = 1; |
| 4096 | codec->pcm_info = info; |
| 4097 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4098 | if (spec->no_analog) |
| 4099 | goto skip_analog; |
| 4100 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4101 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4102 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4103 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4104 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4105 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4106 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4107 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4108 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4109 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4110 | } |
| 4111 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4112 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4113 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4114 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4115 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4116 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4117 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4118 | if (spec->channel_mode) { |
| 4119 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4120 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4121 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4122 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4123 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4124 | } |
| 4125 | } |
| 4126 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4127 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4128 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4129 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4130 | snprintf(spec->stream_name_digital, |
| 4131 | sizeof(spec->stream_name_digital), |
| 4132 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4133 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4134 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4135 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4136 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4137 | if (spec->dig_out_type) |
| 4138 | info->pcm_type = spec->dig_out_type; |
| 4139 | else |
| 4140 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4141 | if (spec->multiout.dig_out_nid && |
| 4142 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4143 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4144 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4145 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4146 | if (spec->dig_in_nid && |
| 4147 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4148 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4149 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4150 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4151 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4152 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4153 | } |
| 4154 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4155 | if (spec->no_analog) |
| 4156 | return 0; |
| 4157 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4158 | /* If the use of more than one ADC is requested for the current |
| 4159 | * model, configure a second analog capture-only PCM. |
| 4160 | */ |
| 4161 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4162 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4163 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4164 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4165 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4166 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4167 | if (spec->alt_dac_nid) { |
| 4168 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4169 | *spec->stream_analog_alt_playback; |
| 4170 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4171 | spec->alt_dac_nid; |
| 4172 | } else { |
| 4173 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4174 | alc_pcm_null_stream; |
| 4175 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4176 | } |
| 4177 | if (spec->num_adc_nids > 1) { |
| 4178 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4179 | *spec->stream_analog_alt_capture; |
| 4180 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4181 | spec->adc_nids[1]; |
| 4182 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4183 | spec->num_adc_nids - 1; |
| 4184 | } else { |
| 4185 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4186 | alc_pcm_null_stream; |
| 4187 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4188 | } |
| 4189 | } |
| 4190 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4191 | return 0; |
| 4192 | } |
| 4193 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4194 | static inline void alc_shutup(struct hda_codec *codec) |
| 4195 | { |
| 4196 | snd_hda_shutup_pins(codec); |
| 4197 | } |
| 4198 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4199 | static void alc_free_kctls(struct hda_codec *codec) |
| 4200 | { |
| 4201 | struct alc_spec *spec = codec->spec; |
| 4202 | |
| 4203 | if (spec->kctls.list) { |
| 4204 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4205 | int i; |
| 4206 | for (i = 0; i < spec->kctls.used; i++) |
| 4207 | kfree(kctl[i].name); |
| 4208 | } |
| 4209 | snd_array_free(&spec->kctls); |
| 4210 | } |
| 4211 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4212 | static void alc_free(struct hda_codec *codec) |
| 4213 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4214 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4215 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4216 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4217 | return; |
| 4218 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4219 | alc_shutup(codec); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 4220 | snd_hda_input_jack_free(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4221 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4222 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4223 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4224 | } |
| 4225 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4226 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4227 | static void alc_power_eapd(struct hda_codec *codec) |
| 4228 | { |
| 4229 | /* We currently only handle front, HP */ |
| 4230 | switch (codec->vendor_id) { |
| 4231 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4232 | set_eapd(codec, 0x0f, 0); |
| 4233 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4234 | break; |
| 4235 | case 0x10ec0262: |
| 4236 | case 0x10ec0267: |
| 4237 | case 0x10ec0268: |
| 4238 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4239 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4240 | case 0x10ec0272: |
| 4241 | case 0x10ec0660: |
| 4242 | case 0x10ec0662: |
| 4243 | case 0x10ec0663: |
Andres Mejia | 75eb1c3 | 2011-03-20 14:07:40 -0400 | [diff] [blame] | 4244 | case 0x10ec0665: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4245 | case 0x10ec0862: |
| 4246 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4247 | set_eapd(codec, 0x14, 0); |
| 4248 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4249 | break; |
| 4250 | } |
| 4251 | } |
| 4252 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4253 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4254 | { |
| 4255 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4256 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4257 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4258 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4259 | return 0; |
| 4260 | } |
| 4261 | #endif |
| 4262 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4263 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4264 | static int alc_resume(struct hda_codec *codec) |
| 4265 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4266 | codec->patch_ops.init(codec); |
| 4267 | snd_hda_codec_resume_amp(codec); |
| 4268 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4269 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4270 | return 0; |
| 4271 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4272 | #endif |
| 4273 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4274 | /* |
| 4275 | */ |
| 4276 | static struct hda_codec_ops alc_patch_ops = { |
| 4277 | .build_controls = alc_build_controls, |
| 4278 | .build_pcms = alc_build_pcms, |
| 4279 | .init = alc_init, |
| 4280 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4281 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4282 | #ifdef SND_HDA_NEEDS_RESUME |
| 4283 | .resume = alc_resume, |
| 4284 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4285 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4286 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4287 | .check_power_status = alc_check_power_status, |
| 4288 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4289 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4290 | }; |
| 4291 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4292 | /* replace the codec chip_name with the given string */ |
| 4293 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4294 | { |
| 4295 | kfree(codec->chip_name); |
| 4296 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4297 | if (!codec->chip_name) { |
| 4298 | alc_free(codec); |
| 4299 | return -ENOMEM; |
| 4300 | } |
| 4301 | return 0; |
| 4302 | } |
| 4303 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4304 | /* |
| 4305 | * Test configuration for debugging |
| 4306 | * |
| 4307 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4308 | * enum controls. |
| 4309 | */ |
| 4310 | #ifdef CONFIG_SND_DEBUG |
| 4311 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4312 | 0x02, 0x03, 0x04, 0x05 |
| 4313 | }; |
| 4314 | |
| 4315 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4316 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4317 | .items = { |
| 4318 | { "In-1", 0x0 }, |
| 4319 | { "In-2", 0x1 }, |
| 4320 | { "In-3", 0x2 }, |
| 4321 | { "In-4", 0x3 }, |
| 4322 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4323 | { "Front", 0x5 }, |
| 4324 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4325 | }, |
| 4326 | }; |
| 4327 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4328 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4329 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4330 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4331 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4332 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4333 | }; |
| 4334 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4335 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4336 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4337 | { |
| 4338 | static char *texts[] = { |
| 4339 | "N/A", "Line Out", "HP Out", |
| 4340 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4341 | }; |
| 4342 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4343 | uinfo->count = 1; |
| 4344 | uinfo->value.enumerated.items = 8; |
| 4345 | if (uinfo->value.enumerated.item >= 8) |
| 4346 | uinfo->value.enumerated.item = 7; |
| 4347 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4348 | return 0; |
| 4349 | } |
| 4350 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4351 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4352 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4353 | { |
| 4354 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4355 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4356 | unsigned int pin_ctl, item = 0; |
| 4357 | |
| 4358 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4359 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4360 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4361 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4362 | item = 2; |
| 4363 | else |
| 4364 | item = 1; |
| 4365 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4366 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4367 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4368 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4369 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4370 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4371 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4372 | } |
| 4373 | } |
| 4374 | ucontrol->value.enumerated.item[0] = item; |
| 4375 | return 0; |
| 4376 | } |
| 4377 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4378 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4379 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4380 | { |
| 4381 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4382 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4383 | static unsigned int ctls[] = { |
| 4384 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4385 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4386 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4387 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4388 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4389 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4390 | }; |
| 4391 | unsigned int old_ctl, new_ctl; |
| 4392 | |
| 4393 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4394 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4395 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4396 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4397 | int val; |
| 4398 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4399 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4400 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4401 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4402 | HDA_AMP_MUTE : 0; |
| 4403 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4404 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4405 | return 1; |
| 4406 | } |
| 4407 | return 0; |
| 4408 | } |
| 4409 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4410 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4411 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4412 | { |
| 4413 | static char *texts[] = { |
| 4414 | "Front", "Surround", "CLFE", "Side" |
| 4415 | }; |
| 4416 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4417 | uinfo->count = 1; |
| 4418 | uinfo->value.enumerated.items = 4; |
| 4419 | if (uinfo->value.enumerated.item >= 4) |
| 4420 | uinfo->value.enumerated.item = 3; |
| 4421 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4422 | return 0; |
| 4423 | } |
| 4424 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4425 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4426 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4427 | { |
| 4428 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4429 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4430 | unsigned int sel; |
| 4431 | |
| 4432 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4433 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4434 | return 0; |
| 4435 | } |
| 4436 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4437 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4438 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4439 | { |
| 4440 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4441 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4442 | unsigned int sel; |
| 4443 | |
| 4444 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4445 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4446 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4447 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4448 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4449 | return 1; |
| 4450 | } |
| 4451 | return 0; |
| 4452 | } |
| 4453 | |
| 4454 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4455 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4456 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4457 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4458 | .info = alc_test_pin_ctl_info, \ |
| 4459 | .get = alc_test_pin_ctl_get, \ |
| 4460 | .put = alc_test_pin_ctl_put, \ |
| 4461 | .private_value = nid \ |
| 4462 | } |
| 4463 | |
| 4464 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4465 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4466 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4467 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4468 | .info = alc_test_pin_src_info, \ |
| 4469 | .get = alc_test_pin_src_get, \ |
| 4470 | .put = alc_test_pin_src_put, \ |
| 4471 | .private_value = nid \ |
| 4472 | } |
| 4473 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4474 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4475 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4476 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4477 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4478 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4479 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4480 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4481 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4482 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4483 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4484 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4485 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4486 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4487 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4488 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4489 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4490 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4491 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4492 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4493 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4494 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4495 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4496 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4497 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4498 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4499 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4500 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4501 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4502 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4503 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4504 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4505 | { |
| 4506 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4507 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4508 | .info = alc_ch_mode_info, |
| 4509 | .get = alc_ch_mode_get, |
| 4510 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4511 | }, |
| 4512 | { } /* end */ |
| 4513 | }; |
| 4514 | |
| 4515 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4516 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4519 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4520 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4521 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4522 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4523 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4524 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4525 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4526 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4527 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4528 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4529 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4530 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4531 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4532 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4533 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4534 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4535 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4536 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4537 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4538 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4539 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4540 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4541 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4542 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4543 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4544 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4545 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4546 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4547 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4548 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4549 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4550 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4551 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4552 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4553 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4554 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4555 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4556 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4557 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4558 | /* Analog input/passthru */ |
| 4559 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4560 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4561 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4562 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4563 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4564 | { } |
| 4565 | }; |
| 4566 | #endif |
| 4567 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4568 | /* |
| 4569 | */ |
| 4570 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 4571 | static const char * const alc880_models[ALC880_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4572 | [ALC880_3ST] = "3stack", |
| 4573 | [ALC880_TCL_S700] = "tcl", |
| 4574 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4575 | [ALC880_CLEVO] = "clevo", |
| 4576 | [ALC880_5ST] = "5stack", |
| 4577 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4578 | [ALC880_W810] = "w810", |
| 4579 | [ALC880_Z71V] = "z71v", |
| 4580 | [ALC880_6ST] = "6stack", |
| 4581 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4582 | [ALC880_ASUS] = "asus", |
| 4583 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4584 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4585 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4586 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4587 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4588 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4589 | [ALC880_F1734] = "F1734", |
| 4590 | [ALC880_LG] = "lg", |
| 4591 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4592 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4593 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4594 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4595 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4596 | [ALC880_AUTO] = "auto", |
| 4597 | }; |
| 4598 | |
| 4599 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4600 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4601 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4602 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4603 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4604 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4605 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4606 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4607 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4608 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4609 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4610 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4611 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4612 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4613 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4614 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4615 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4616 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4617 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4618 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4619 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4620 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4621 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4622 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4623 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4624 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4625 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4626 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4627 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4628 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4629 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4630 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4631 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4632 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4633 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4634 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4635 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4636 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4637 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4638 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4639 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Justin P. Mattock | a2e2bc2 | 2011-02-24 22:16:02 -0800 | [diff] [blame] | 4640 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4641 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4642 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4643 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4644 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4645 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4646 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4647 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4648 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4649 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4650 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4651 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4652 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4653 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4654 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4655 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4656 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4657 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4658 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4659 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4660 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4661 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4662 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4663 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4664 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4665 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4666 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4667 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4668 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4669 | /* default Intel */ |
| 4670 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4671 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4672 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4673 | {} |
| 4674 | }; |
| 4675 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4676 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4677 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4678 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4679 | static struct alc_config_preset alc880_presets[] = { |
| 4680 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4681 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4682 | .init_verbs = { alc880_volume_init_verbs, |
| 4683 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4684 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4685 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4686 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4687 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4688 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4689 | .input_mux = &alc880_capture_source, |
| 4690 | }, |
| 4691 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4692 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4693 | .init_verbs = { alc880_volume_init_verbs, |
| 4694 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4695 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4696 | .dac_nids = alc880_dac_nids, |
| 4697 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4698 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4699 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4700 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4701 | .input_mux = &alc880_capture_source, |
| 4702 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4703 | [ALC880_TCL_S700] = { |
| 4704 | .mixers = { alc880_tcl_s700_mixer }, |
| 4705 | .init_verbs = { alc880_volume_init_verbs, |
| 4706 | alc880_pin_tcl_S700_init_verbs, |
| 4707 | alc880_gpio2_init_verbs }, |
| 4708 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4709 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4710 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4711 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4712 | .hp_nid = 0x03, |
| 4713 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4714 | .channel_mode = alc880_2_jack_modes, |
| 4715 | .input_mux = &alc880_capture_source, |
| 4716 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4717 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4718 | .mixers = { alc880_three_stack_mixer, |
| 4719 | alc880_five_stack_mixer}, |
| 4720 | .init_verbs = { alc880_volume_init_verbs, |
| 4721 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4722 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4723 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4724 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4725 | .channel_mode = alc880_fivestack_modes, |
| 4726 | .input_mux = &alc880_capture_source, |
| 4727 | }, |
| 4728 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4729 | .mixers = { alc880_three_stack_mixer, |
| 4730 | alc880_five_stack_mixer }, |
| 4731 | .init_verbs = { alc880_volume_init_verbs, |
| 4732 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4733 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4734 | .dac_nids = alc880_dac_nids, |
| 4735 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4736 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4737 | .channel_mode = alc880_fivestack_modes, |
| 4738 | .input_mux = &alc880_capture_source, |
| 4739 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4740 | [ALC880_6ST] = { |
| 4741 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4742 | .init_verbs = { alc880_volume_init_verbs, |
| 4743 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4744 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4745 | .dac_nids = alc880_6st_dac_nids, |
| 4746 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4747 | .channel_mode = alc880_sixstack_modes, |
| 4748 | .input_mux = &alc880_6stack_capture_source, |
| 4749 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4750 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4751 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4752 | .init_verbs = { alc880_volume_init_verbs, |
| 4753 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4754 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4755 | .dac_nids = alc880_6st_dac_nids, |
| 4756 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4757 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4758 | .channel_mode = alc880_sixstack_modes, |
| 4759 | .input_mux = &alc880_6stack_capture_source, |
| 4760 | }, |
| 4761 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4762 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4763 | .init_verbs = { alc880_volume_init_verbs, |
| 4764 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4765 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4766 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4767 | .dac_nids = alc880_w810_dac_nids, |
| 4768 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4769 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4770 | .channel_mode = alc880_w810_modes, |
| 4771 | .input_mux = &alc880_capture_source, |
| 4772 | }, |
| 4773 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4774 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4775 | .init_verbs = { alc880_volume_init_verbs, |
| 4776 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4777 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4778 | .dac_nids = alc880_z71v_dac_nids, |
| 4779 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4780 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4781 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4782 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4783 | .input_mux = &alc880_capture_source, |
| 4784 | }, |
| 4785 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4786 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4787 | .init_verbs = { alc880_volume_init_verbs, |
| 4788 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4789 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4790 | .dac_nids = alc880_f1734_dac_nids, |
| 4791 | .hp_nid = 0x02, |
| 4792 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4793 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4794 | .input_mux = &alc880_f1734_capture_source, |
| 4795 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4796 | .setup = alc880_uniwill_p53_setup, |
| 4797 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4798 | }, |
| 4799 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4800 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4801 | .init_verbs = { alc880_volume_init_verbs, |
| 4802 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4803 | alc880_gpio1_init_verbs }, |
| 4804 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4805 | .dac_nids = alc880_asus_dac_nids, |
| 4806 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4807 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4808 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4809 | .input_mux = &alc880_capture_source, |
| 4810 | }, |
| 4811 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4812 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4813 | .init_verbs = { alc880_volume_init_verbs, |
| 4814 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4815 | alc880_gpio1_init_verbs }, |
| 4816 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4817 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4818 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4819 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4820 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4821 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4822 | .input_mux = &alc880_capture_source, |
| 4823 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4824 | [ALC880_ASUS_DIG2] = { |
| 4825 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4826 | .init_verbs = { alc880_volume_init_verbs, |
| 4827 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4828 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4829 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4830 | .dac_nids = alc880_asus_dac_nids, |
| 4831 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4832 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4833 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4834 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4835 | .input_mux = &alc880_capture_source, |
| 4836 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4837 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4838 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4839 | .init_verbs = { alc880_volume_init_verbs, |
| 4840 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4841 | alc880_gpio1_init_verbs }, |
| 4842 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4843 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4844 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4845 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4846 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4847 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4848 | .input_mux = &alc880_capture_source, |
| 4849 | }, |
| 4850 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4851 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4852 | .init_verbs = { alc880_volume_init_verbs, |
| 4853 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4854 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4855 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4856 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4857 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4858 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4859 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4860 | .input_mux = &alc880_capture_source, |
| 4861 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4862 | [ALC880_UNIWILL] = { |
| 4863 | .mixers = { alc880_uniwill_mixer }, |
| 4864 | .init_verbs = { alc880_volume_init_verbs, |
| 4865 | alc880_uniwill_init_verbs }, |
| 4866 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4867 | .dac_nids = alc880_asus_dac_nids, |
| 4868 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4869 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4870 | .channel_mode = alc880_threestack_modes, |
| 4871 | .need_dac_fix = 1, |
| 4872 | .input_mux = &alc880_capture_source, |
| 4873 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4874 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4875 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4876 | }, |
| 4877 | [ALC880_UNIWILL_P53] = { |
| 4878 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4879 | .init_verbs = { alc880_volume_init_verbs, |
| 4880 | alc880_uniwill_p53_init_verbs }, |
| 4881 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4882 | .dac_nids = alc880_asus_dac_nids, |
| 4883 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4884 | .channel_mode = alc880_threestack_modes, |
| 4885 | .input_mux = &alc880_capture_source, |
| 4886 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4887 | .setup = alc880_uniwill_p53_setup, |
| 4888 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4889 | }, |
| 4890 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4891 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4892 | .init_verbs = { alc880_volume_init_verbs, |
| 4893 | alc880_uniwill_p53_init_verbs, |
| 4894 | alc880_beep_init_verbs }, |
| 4895 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4896 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4897 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4898 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4899 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4900 | .input_mux = &alc880_capture_source, |
| 4901 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4902 | .setup = alc880_uniwill_p53_setup, |
| 4903 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4904 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4905 | [ALC880_CLEVO] = { |
| 4906 | .mixers = { alc880_three_stack_mixer }, |
| 4907 | .init_verbs = { alc880_volume_init_verbs, |
| 4908 | alc880_pin_clevo_init_verbs }, |
| 4909 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4910 | .dac_nids = alc880_dac_nids, |
| 4911 | .hp_nid = 0x03, |
| 4912 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4913 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4914 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4915 | .input_mux = &alc880_capture_source, |
| 4916 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4917 | [ALC880_LG] = { |
| 4918 | .mixers = { alc880_lg_mixer }, |
| 4919 | .init_verbs = { alc880_volume_init_verbs, |
| 4920 | alc880_lg_init_verbs }, |
| 4921 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4922 | .dac_nids = alc880_lg_dac_nids, |
| 4923 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4924 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4925 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4926 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4927 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4928 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4929 | .setup = alc880_lg_setup, |
| 4930 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4931 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4932 | .loopbacks = alc880_lg_loopbacks, |
| 4933 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4934 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4935 | [ALC880_LG_LW] = { |
| 4936 | .mixers = { alc880_lg_lw_mixer }, |
| 4937 | .init_verbs = { alc880_volume_init_verbs, |
| 4938 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4939 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4940 | .dac_nids = alc880_dac_nids, |
| 4941 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4942 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4943 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4944 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4945 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4946 | .setup = alc880_lg_lw_setup, |
| 4947 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4948 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4949 | [ALC880_MEDION_RIM] = { |
| 4950 | .mixers = { alc880_medion_rim_mixer }, |
| 4951 | .init_verbs = { alc880_volume_init_verbs, |
| 4952 | alc880_medion_rim_init_verbs, |
| 4953 | alc_gpio2_init_verbs }, |
| 4954 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4955 | .dac_nids = alc880_dac_nids, |
| 4956 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4957 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4958 | .channel_mode = alc880_2_jack_modes, |
| 4959 | .input_mux = &alc880_medion_rim_capture_source, |
| 4960 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4961 | .setup = alc880_medion_rim_setup, |
| 4962 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4963 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4964 | #ifdef CONFIG_SND_DEBUG |
| 4965 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4966 | .mixers = { alc880_test_mixer }, |
| 4967 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4968 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4969 | .dac_nids = alc880_test_dac_nids, |
| 4970 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4971 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4972 | .channel_mode = alc880_test_modes, |
| 4973 | .input_mux = &alc880_test_capture_source, |
| 4974 | }, |
| 4975 | #endif |
| 4976 | }; |
| 4977 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4978 | /* |
| 4979 | * Automatic parse of I/O pins from the BIOS configuration |
| 4980 | */ |
| 4981 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4982 | enum { |
| 4983 | ALC_CTL_WIDGET_VOL, |
| 4984 | ALC_CTL_WIDGET_MUTE, |
| 4985 | ALC_CTL_BIND_MUTE, |
| 4986 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4987 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4988 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4989 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4990 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4991 | }; |
| 4992 | |
| 4993 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4994 | 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] | 4995 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4996 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4997 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4998 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4999 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 5000 | knew = snd_array_new(&spec->kctls); |
| 5001 | if (!knew) |
| 5002 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5003 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5004 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5005 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5006 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5007 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5008 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5009 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5010 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5011 | return 0; |
| 5012 | } |
| 5013 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5014 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5015 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5016 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5017 | { |
| 5018 | char name[32]; |
| 5019 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5020 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5021 | } |
| 5022 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5023 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5024 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5025 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5026 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5027 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5028 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5029 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5030 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5031 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5032 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5033 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5034 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5035 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5036 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5037 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5038 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5039 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5040 | #define ALC880_PIN_CD_NID 0x1c |
| 5041 | |
| 5042 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5043 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5044 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5045 | { |
| 5046 | hda_nid_t nid; |
| 5047 | int assigned[4]; |
| 5048 | int i, j; |
| 5049 | |
| 5050 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5051 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5052 | |
| 5053 | /* check the pins hardwired to audio widget */ |
| 5054 | for (i = 0; i < cfg->line_outs; i++) { |
| 5055 | nid = cfg->line_out_pins[i]; |
| 5056 | if (alc880_is_fixed_pin(nid)) { |
| 5057 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5058 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5059 | assigned[idx] = 1; |
| 5060 | } |
| 5061 | } |
| 5062 | /* left pins can be connect to any audio widget */ |
| 5063 | for (i = 0; i < cfg->line_outs; i++) { |
| 5064 | nid = cfg->line_out_pins[i]; |
| 5065 | if (alc880_is_fixed_pin(nid)) |
| 5066 | continue; |
| 5067 | /* search for an empty channel */ |
| 5068 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5069 | if (!assigned[j]) { |
| 5070 | spec->multiout.dac_nids[i] = |
| 5071 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5072 | assigned[j] = 1; |
| 5073 | break; |
| 5074 | } |
| 5075 | } |
| 5076 | } |
| 5077 | spec->multiout.num_dacs = cfg->line_outs; |
| 5078 | return 0; |
| 5079 | } |
| 5080 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5081 | static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg, |
| 5082 | bool can_be_master) |
| 5083 | { |
| 5084 | if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
| 5085 | return "Master"; |
| 5086 | |
| 5087 | switch (cfg->line_out_type) { |
| 5088 | case AUTO_PIN_SPEAKER_OUT: |
David Henningsson | ebbeb3d | 2011-03-04 14:08:30 +0100 | [diff] [blame] | 5089 | if (cfg->line_outs == 1) |
| 5090 | return "Speaker"; |
| 5091 | break; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5092 | case AUTO_PIN_HP_OUT: |
| 5093 | return "Headphone"; |
| 5094 | default: |
| 5095 | if (cfg->line_outs == 1) |
| 5096 | return "PCM"; |
| 5097 | break; |
| 5098 | } |
| 5099 | return NULL; |
| 5100 | } |
| 5101 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5102 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5103 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5104 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5105 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 5106 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5107 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5108 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5109 | const char *pfx = alc_get_line_out_pfx(cfg, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5110 | hda_nid_t nid; |
| 5111 | int i, err; |
| 5112 | |
| 5113 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5114 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5115 | continue; |
| 5116 | 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] | 5117 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5118 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5119 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5120 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5121 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5122 | HDA_OUTPUT)); |
| 5123 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5124 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5125 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5126 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5127 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5128 | HDA_OUTPUT)); |
| 5129 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5130 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5131 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5132 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5133 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5134 | HDA_INPUT)); |
| 5135 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5136 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5137 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5138 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5139 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5140 | HDA_INPUT)); |
| 5141 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5142 | return err; |
| 5143 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5144 | const char *name = pfx; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5145 | int index = i; |
| 5146 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5147 | name = chname[i]; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5148 | index = 0; |
| 5149 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5150 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5151 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5152 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5153 | HDA_OUTPUT)); |
| 5154 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5155 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5156 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5157 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5158 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5159 | HDA_INPUT)); |
| 5160 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5161 | return err; |
| 5162 | } |
| 5163 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5164 | return 0; |
| 5165 | } |
| 5166 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5167 | /* add playback controls for speaker and HP outputs */ |
| 5168 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5169 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5170 | { |
| 5171 | hda_nid_t nid; |
| 5172 | int err; |
| 5173 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5174 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5175 | return 0; |
| 5176 | |
| 5177 | if (alc880_is_fixed_pin(pin)) { |
| 5178 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5179 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5180 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5181 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5182 | else |
| 5183 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5184 | /* control HP volume/switch on the output mixer amp */ |
| 5185 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5186 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5187 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5188 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5189 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5190 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5191 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5192 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5193 | return err; |
| 5194 | } else if (alc880_is_multi_pin(pin)) { |
| 5195 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5196 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5197 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5198 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5199 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5200 | return err; |
| 5201 | } |
| 5202 | return 0; |
| 5203 | } |
| 5204 | |
| 5205 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5206 | 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] | 5207 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5208 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5209 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5210 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5211 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5212 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5213 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5214 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5215 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5216 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5217 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5218 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5219 | return err; |
| 5220 | return 0; |
| 5221 | } |
| 5222 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5223 | 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] | 5224 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5225 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5226 | return (pincap & AC_PINCAP_IN) != 0; |
| 5227 | } |
| 5228 | |
| 5229 | /* create playback/capture controls for input pins */ |
| 5230 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5231 | const struct auto_pin_cfg *cfg, |
| 5232 | hda_nid_t mixer, |
| 5233 | hda_nid_t cap1, hda_nid_t cap2) |
| 5234 | { |
| 5235 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5236 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5237 | int i, err, idx, type_idx = 0; |
| 5238 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5239 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5240 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5241 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5242 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5243 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5244 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5245 | if (!alc_is_input_pin(codec, pin)) |
| 5246 | continue; |
| 5247 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5248 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5249 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5250 | type_idx++; |
| 5251 | else |
| 5252 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5253 | prev_label = label; |
| 5254 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5255 | if (mixer) { |
| 5256 | idx = get_connection_index(codec, mixer, pin); |
| 5257 | if (idx >= 0) { |
| 5258 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5259 | label, type_idx, |
| 5260 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5261 | if (err < 0) |
| 5262 | return err; |
| 5263 | } |
| 5264 | } |
| 5265 | |
| 5266 | if (!cap1) |
| 5267 | continue; |
| 5268 | idx = get_connection_index(codec, cap1, pin); |
| 5269 | if (idx < 0 && cap2) |
| 5270 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5271 | if (idx >= 0) |
| 5272 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5273 | } |
| 5274 | return 0; |
| 5275 | } |
| 5276 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5277 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5278 | const struct auto_pin_cfg *cfg) |
| 5279 | { |
| 5280 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5281 | } |
| 5282 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5283 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5284 | unsigned int pin_type) |
| 5285 | { |
| 5286 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5287 | pin_type); |
| 5288 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5289 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5290 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5291 | } |
| 5292 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5293 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5294 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5295 | int dac_idx) |
| 5296 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5297 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5298 | /* need the manual connection? */ |
| 5299 | if (alc880_is_multi_pin(nid)) { |
| 5300 | struct alc_spec *spec = codec->spec; |
| 5301 | int idx = alc880_multi_pin_idx(nid); |
| 5302 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5303 | AC_VERB_SET_CONNECT_SEL, |
| 5304 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5305 | } |
| 5306 | } |
| 5307 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5308 | static int get_pin_type(int line_out_type) |
| 5309 | { |
| 5310 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5311 | return PIN_HP; |
| 5312 | else |
| 5313 | return PIN_OUT; |
| 5314 | } |
| 5315 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5316 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5317 | { |
| 5318 | struct alc_spec *spec = codec->spec; |
| 5319 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5320 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5321 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5322 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5323 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5324 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5325 | } |
| 5326 | } |
| 5327 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5328 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5329 | { |
| 5330 | struct alc_spec *spec = codec->spec; |
| 5331 | hda_nid_t pin; |
| 5332 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5333 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5334 | if (pin) /* connect to front */ |
| 5335 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5336 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5337 | if (pin) /* connect to front */ |
| 5338 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5339 | } |
| 5340 | |
| 5341 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5342 | { |
| 5343 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5344 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5345 | int i; |
| 5346 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5347 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5348 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5349 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5350 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5351 | if (nid != ALC880_PIN_CD_NID && |
| 5352 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5353 | snd_hda_codec_write(codec, nid, 0, |
| 5354 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5355 | AMP_OUT_MUTE); |
| 5356 | } |
| 5357 | } |
| 5358 | } |
| 5359 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5360 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5361 | { |
| 5362 | struct alc_spec *spec = codec->spec; |
| 5363 | int c; |
| 5364 | |
| 5365 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5366 | unsigned int mux_idx; |
| 5367 | const struct hda_input_mux *imux; |
| 5368 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5369 | imux = &spec->input_mux[mux_idx]; |
| 5370 | if (!imux->num_items && mux_idx > 0) |
| 5371 | imux = &spec->input_mux[0]; |
| 5372 | if (imux) |
| 5373 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5374 | AC_VERB_SET_CONNECT_SEL, |
| 5375 | imux->items[0].index); |
| 5376 | } |
| 5377 | } |
| 5378 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5379 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5380 | /* return 1 if successful, 0 if the proper config is not found, |
| 5381 | * or a negative error code |
| 5382 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5383 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5384 | { |
| 5385 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5386 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5387 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5388 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5389 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5390 | alc880_ignore); |
| 5391 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5392 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5393 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5394 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5395 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5396 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5397 | if (err < 0) |
| 5398 | return err; |
| 5399 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5400 | if (err < 0) |
| 5401 | return err; |
| 5402 | err = alc880_auto_create_extra_out(spec, |
| 5403 | spec->autocfg.speaker_pins[0], |
| 5404 | "Speaker"); |
| 5405 | if (err < 0) |
| 5406 | return err; |
| 5407 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5408 | "Headphone"); |
| 5409 | if (err < 0) |
| 5410 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5411 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5412 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5413 | return err; |
| 5414 | |
| 5415 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5416 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5417 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5418 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5419 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5420 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5421 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5422 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5423 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5424 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5425 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5426 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5427 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5428 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5429 | return 1; |
| 5430 | } |
| 5431 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5432 | /* additional initialization for auto-configuration model */ |
| 5433 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5434 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5435 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5436 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5437 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5438 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5439 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5440 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5441 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5442 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5443 | } |
| 5444 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5445 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5446 | * one of two digital mic pins, e.g. on ALC272 |
| 5447 | */ |
| 5448 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5449 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5450 | struct alc_spec *spec = codec->spec; |
| 5451 | int i; |
| 5452 | |
| 5453 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5454 | hda_nid_t cap = spec->capsrc_nids ? |
| 5455 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5456 | int iidx, eidx; |
| 5457 | |
| 5458 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5459 | if (iidx < 0) |
| 5460 | continue; |
| 5461 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5462 | if (eidx < 0) |
| 5463 | continue; |
| 5464 | spec->int_mic.mux_idx = iidx; |
| 5465 | spec->ext_mic.mux_idx = eidx; |
| 5466 | if (spec->capsrc_nids) |
| 5467 | spec->capsrc_nids += i; |
| 5468 | spec->adc_nids += i; |
| 5469 | spec->num_adc_nids = 1; |
| 5470 | return; |
| 5471 | } |
| 5472 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5473 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5474 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5475 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5476 | } |
| 5477 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5478 | /* select or unmute the given capsrc route */ |
| 5479 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5480 | int idx) |
| 5481 | { |
| 5482 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5483 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5484 | HDA_AMP_MUTE, 0); |
| 5485 | } else { |
| 5486 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5487 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5488 | } |
| 5489 | } |
| 5490 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5491 | /* set the default connection to that pin */ |
| 5492 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5493 | { |
| 5494 | struct alc_spec *spec = codec->spec; |
| 5495 | int i; |
| 5496 | |
| 5497 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5498 | hda_nid_t cap = spec->capsrc_nids ? |
| 5499 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5500 | int idx; |
| 5501 | |
| 5502 | idx = get_connection_index(codec, cap, pin); |
| 5503 | if (idx < 0) |
| 5504 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5505 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5506 | return i; /* return the found index */ |
| 5507 | } |
| 5508 | return -1; /* not found */ |
| 5509 | } |
| 5510 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5511 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5512 | static void fixup_single_adc(struct hda_codec *codec) |
| 5513 | { |
| 5514 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5515 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5516 | int i; |
| 5517 | |
| 5518 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5519 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5520 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5521 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5522 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5523 | /* use only this ADC */ |
| 5524 | if (spec->capsrc_nids) |
| 5525 | spec->capsrc_nids += i; |
| 5526 | spec->adc_nids += i; |
| 5527 | spec->num_adc_nids = 1; |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5528 | spec->single_input_src = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5529 | } |
| 5530 | } |
| 5531 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5532 | /* initialize dual adcs */ |
| 5533 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5534 | { |
| 5535 | struct alc_spec *spec = codec->spec; |
| 5536 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5537 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5538 | } |
| 5539 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5540 | /* initialize some special cases for input sources */ |
| 5541 | static void alc_init_special_input_src(struct hda_codec *codec) |
| 5542 | { |
| 5543 | struct alc_spec *spec = codec->spec; |
| 5544 | if (spec->dual_adc_switch) |
| 5545 | fixup_dual_adc_switch(codec); |
| 5546 | else if (spec->single_input_src) |
| 5547 | init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); |
| 5548 | } |
| 5549 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5550 | static void set_capture_mixer(struct hda_codec *codec) |
| 5551 | { |
| 5552 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5553 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5554 | { alc_capture_mixer_nosrc1, |
| 5555 | alc_capture_mixer_nosrc2, |
| 5556 | alc_capture_mixer_nosrc3 }, |
| 5557 | { alc_capture_mixer1, |
| 5558 | alc_capture_mixer2, |
| 5559 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5560 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5561 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5562 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5563 | int num_adcs = spec->num_adc_nids; |
| 5564 | if (spec->dual_adc_switch) |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5565 | num_adcs = 1; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5566 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5567 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5568 | else if (spec->input_mux) { |
| 5569 | if (spec->input_mux->num_items > 1) |
| 5570 | mux = 1; |
| 5571 | else if (spec->input_mux->num_items == 1) |
| 5572 | fixup_single_adc(codec); |
| 5573 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5574 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5575 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5576 | } |
| 5577 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5578 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5579 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5580 | int num_nids) |
| 5581 | { |
| 5582 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5583 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5584 | int n; |
| 5585 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5586 | |
| 5587 | for (n = 0; n < num_nids; n++) { |
| 5588 | hda_nid_t adc, cap; |
| 5589 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5590 | int nconns, i, j; |
| 5591 | |
| 5592 | adc = nids[n]; |
| 5593 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5594 | continue; |
| 5595 | cap = adc; |
| 5596 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5597 | ARRAY_SIZE(conn)); |
| 5598 | if (nconns == 1) { |
| 5599 | cap = conn[0]; |
| 5600 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5601 | ARRAY_SIZE(conn)); |
| 5602 | } |
| 5603 | if (nconns <= 0) |
| 5604 | continue; |
| 5605 | if (!fallback_adc) { |
| 5606 | fallback_adc = adc; |
| 5607 | fallback_cap = cap; |
| 5608 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5609 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5610 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5611 | for (j = 0; j < nconns; j++) { |
| 5612 | if (conn[j] == nid) |
| 5613 | break; |
| 5614 | } |
| 5615 | if (j >= nconns) |
| 5616 | break; |
| 5617 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5618 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5619 | int num_adcs = spec->num_adc_nids; |
| 5620 | spec->private_adc_nids[num_adcs] = adc; |
| 5621 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5622 | spec->num_adc_nids++; |
| 5623 | spec->adc_nids = spec->private_adc_nids; |
| 5624 | if (adc != cap) |
| 5625 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5626 | } |
| 5627 | } |
| 5628 | if (!spec->num_adc_nids) { |
| 5629 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5630 | " using fallback 0x%x\n", |
| 5631 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5632 | spec->private_adc_nids[0] = fallback_adc; |
| 5633 | spec->adc_nids = spec->private_adc_nids; |
| 5634 | if (fallback_adc != fallback_cap) { |
| 5635 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5636 | spec->capsrc_nids = spec->private_adc_nids; |
| 5637 | } |
| 5638 | } |
| 5639 | } |
| 5640 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5641 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5642 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5643 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5644 | |
| 5645 | static struct snd_pci_quirk beep_white_list[] = { |
| 5646 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5647 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Daniel Cordero | a7e985e | 2011-04-29 08:18:06 +0200 | [diff] [blame] | 5648 | SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5649 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5650 | {} |
| 5651 | }; |
| 5652 | |
| 5653 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5654 | { |
| 5655 | struct alc_spec *spec = codec->spec; |
| 5656 | const struct snd_pci_quirk *q; |
| 5657 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5658 | if (q) |
| 5659 | return q->value; |
| 5660 | return spec->cdefine.enable_pcbeep; |
| 5661 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5662 | #else |
| 5663 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5664 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5665 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5666 | |
| 5667 | /* |
| 5668 | * OK, here we have finally the patch for ALC880 |
| 5669 | */ |
| 5670 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5671 | static int patch_alc880(struct hda_codec *codec) |
| 5672 | { |
| 5673 | struct alc_spec *spec; |
| 5674 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5675 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5676 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5677 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5678 | if (spec == NULL) |
| 5679 | return -ENOMEM; |
| 5680 | |
| 5681 | codec->spec = spec; |
| 5682 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5683 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5684 | alc880_models, |
| 5685 | alc880_cfg_tbl); |
| 5686 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5687 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5688 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5689 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5690 | } |
| 5691 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5692 | if (board_config == ALC880_AUTO) { |
| 5693 | /* automatic parse from the BIOS config */ |
| 5694 | err = alc880_parse_auto_config(codec); |
| 5695 | if (err < 0) { |
| 5696 | alc_free(codec); |
| 5697 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5698 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5699 | printk(KERN_INFO |
| 5700 | "hda_codec: Cannot set up configuration " |
| 5701 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5702 | board_config = ALC880_3ST; |
| 5703 | } |
| 5704 | } |
| 5705 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5706 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5707 | if (err < 0) { |
| 5708 | alc_free(codec); |
| 5709 | return err; |
| 5710 | } |
| 5711 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5712 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5713 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5714 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5715 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5716 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5717 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5718 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5719 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5720 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5721 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5722 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5723 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5724 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5725 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5726 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5727 | if (wcap != AC_WID_AUD_IN) { |
| 5728 | spec->adc_nids = alc880_adc_nids_alt; |
| 5729 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5730 | } else { |
| 5731 | spec->adc_nids = alc880_adc_nids; |
| 5732 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5733 | } |
| 5734 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5735 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5736 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5737 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5738 | spec->vmaster_nid = 0x0c; |
| 5739 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5740 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5741 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5742 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5743 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5744 | if (!spec->loopback.amplist) |
| 5745 | spec->loopback.amplist = alc880_loopbacks; |
| 5746 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5747 | |
| 5748 | return 0; |
| 5749 | } |
| 5750 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5751 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5752 | /* |
| 5753 | * ALC260 support |
| 5754 | */ |
| 5755 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5756 | static hda_nid_t alc260_dac_nids[1] = { |
| 5757 | /* front */ |
| 5758 | 0x02, |
| 5759 | }; |
| 5760 | |
| 5761 | static hda_nid_t alc260_adc_nids[1] = { |
| 5762 | /* ADC0 */ |
| 5763 | 0x04, |
| 5764 | }; |
| 5765 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5766 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5767 | /* ADC1 */ |
| 5768 | 0x05, |
| 5769 | }; |
| 5770 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5771 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5772 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5773 | */ |
| 5774 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5775 | /* ADC0, ADC1 */ |
| 5776 | 0x04, 0x05 |
| 5777 | }; |
| 5778 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5779 | #define ALC260_DIGOUT_NID 0x03 |
| 5780 | #define ALC260_DIGIN_NID 0x06 |
| 5781 | |
| 5782 | static struct hda_input_mux alc260_capture_source = { |
| 5783 | .num_items = 4, |
| 5784 | .items = { |
| 5785 | { "Mic", 0x0 }, |
| 5786 | { "Front Mic", 0x1 }, |
| 5787 | { "Line", 0x2 }, |
| 5788 | { "CD", 0x4 }, |
| 5789 | }, |
| 5790 | }; |
| 5791 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5792 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5793 | * headphone jack and the internal CD lines since these are the only pins at |
| 5794 | * which audio can appear. For flexibility, also allow the option of |
| 5795 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5796 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5797 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5798 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5799 | { |
| 5800 | .num_items = 3, |
| 5801 | .items = { |
| 5802 | { "Mic/Line", 0x0 }, |
| 5803 | { "CD", 0x4 }, |
| 5804 | { "Headphone", 0x2 }, |
| 5805 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5806 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5807 | { |
| 5808 | .num_items = 4, |
| 5809 | .items = { |
| 5810 | { "Mic/Line", 0x0 }, |
| 5811 | { "CD", 0x4 }, |
| 5812 | { "Headphone", 0x2 }, |
| 5813 | { "Mixer", 0x5 }, |
| 5814 | }, |
| 5815 | }, |
| 5816 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5817 | }; |
| 5818 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5819 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5820 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5821 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5822 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5823 | { |
| 5824 | .num_items = 4, |
| 5825 | .items = { |
| 5826 | { "Mic", 0x0 }, |
| 5827 | { "Line", 0x2 }, |
| 5828 | { "CD", 0x4 }, |
| 5829 | { "Headphone", 0x5 }, |
| 5830 | }, |
| 5831 | }, |
| 5832 | { |
| 5833 | .num_items = 5, |
| 5834 | .items = { |
| 5835 | { "Mic", 0x0 }, |
| 5836 | { "Line", 0x2 }, |
| 5837 | { "CD", 0x4 }, |
| 5838 | { "Headphone", 0x6 }, |
| 5839 | { "Mixer", 0x5 }, |
| 5840 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5841 | }, |
| 5842 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5843 | |
| 5844 | /* Maxdata Favorit 100XS */ |
| 5845 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5846 | { |
| 5847 | .num_items = 2, |
| 5848 | .items = { |
| 5849 | { "Line/Mic", 0x0 }, |
| 5850 | { "CD", 0x4 }, |
| 5851 | }, |
| 5852 | }, |
| 5853 | { |
| 5854 | .num_items = 3, |
| 5855 | .items = { |
| 5856 | { "Line/Mic", 0x0 }, |
| 5857 | { "CD", 0x4 }, |
| 5858 | { "Mixer", 0x5 }, |
| 5859 | }, |
| 5860 | }, |
| 5861 | }; |
| 5862 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5863 | /* |
| 5864 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5865 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5866 | * element which allows changing the channel mode, so the verb list is |
| 5867 | * never used. |
| 5868 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5869 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5870 | { 2, NULL }, |
| 5871 | }; |
| 5872 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5873 | |
| 5874 | /* Mixer combinations |
| 5875 | * |
| 5876 | * basic: base_output + input + pc_beep + capture |
| 5877 | * HP: base_output + input + capture_alt |
| 5878 | * HP_3013: hp_3013 + input + capture |
| 5879 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5880 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5881 | */ |
| 5882 | |
| 5883 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5884 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5885 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5886 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5887 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5888 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5889 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5890 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5891 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5892 | |
| 5893 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5894 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5895 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5896 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5897 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5900 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5901 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5902 | { } /* end */ |
| 5903 | }; |
| 5904 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5905 | /* update HP, line and mono out pins according to the master switch */ |
| 5906 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5907 | hda_nid_t hp, hda_nid_t line, |
| 5908 | hda_nid_t mono) |
| 5909 | { |
| 5910 | struct alc_spec *spec = codec->spec; |
| 5911 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5912 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5913 | 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] | 5914 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5915 | 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] | 5916 | val); |
| 5917 | /* mono (speaker) depending on the HP jack sense */ |
| 5918 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5919 | 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] | 5920 | val); |
| 5921 | } |
| 5922 | |
| 5923 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5924 | struct snd_ctl_elem_value *ucontrol) |
| 5925 | { |
| 5926 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5927 | struct alc_spec *spec = codec->spec; |
| 5928 | *ucontrol->value.integer.value = spec->master_sw; |
| 5929 | return 0; |
| 5930 | } |
| 5931 | |
| 5932 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5933 | struct snd_ctl_elem_value *ucontrol) |
| 5934 | { |
| 5935 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5936 | struct alc_spec *spec = codec->spec; |
| 5937 | int val = !!*ucontrol->value.integer.value; |
| 5938 | hda_nid_t hp, line, mono; |
| 5939 | |
| 5940 | if (val == spec->master_sw) |
| 5941 | return 0; |
| 5942 | spec->master_sw = val; |
| 5943 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5944 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5945 | mono = kcontrol->private_value & 0xff; |
| 5946 | alc260_hp_master_update(codec, hp, line, mono); |
| 5947 | return 1; |
| 5948 | } |
| 5949 | |
| 5950 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5951 | { |
| 5952 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5953 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5954 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5955 | .info = snd_ctl_boolean_mono_info, |
| 5956 | .get = alc260_hp_master_sw_get, |
| 5957 | .put = alc260_hp_master_sw_put, |
| 5958 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5959 | }, |
| 5960 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5961 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5962 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5963 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5964 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5965 | HDA_OUTPUT), |
| 5966 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5967 | { } /* end */ |
| 5968 | }; |
| 5969 | |
| 5970 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5971 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5972 | {}, |
| 5973 | }; |
| 5974 | |
| 5975 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5976 | { |
| 5977 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5978 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5979 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5980 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5981 | } |
| 5982 | |
| 5983 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5984 | { |
| 5985 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5986 | alc260_hp_automute(codec); |
| 5987 | } |
| 5988 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5989 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5990 | { |
| 5991 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5992 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5993 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5994 | .info = snd_ctl_boolean_mono_info, |
| 5995 | .get = alc260_hp_master_sw_get, |
| 5996 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5997 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5998 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5999 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6000 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6001 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6002 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6003 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6004 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6005 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6006 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6007 | { } /* end */ |
| 6008 | }; |
| 6009 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6010 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 6011 | .ops = &snd_hda_bind_vol, |
| 6012 | .values = { |
| 6013 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6014 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6015 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6016 | 0 |
| 6017 | }, |
| 6018 | }; |
| 6019 | |
| 6020 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 6021 | .ops = &snd_hda_bind_sw, |
| 6022 | .values = { |
| 6023 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6024 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6025 | 0 |
| 6026 | }, |
| 6027 | }; |
| 6028 | |
| 6029 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 6030 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6031 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6032 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6033 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6034 | { } /* end */ |
| 6035 | }; |
| 6036 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6037 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 6038 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6039 | {}, |
| 6040 | }; |
| 6041 | |
| 6042 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 6043 | { |
| 6044 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6045 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6046 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6047 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6048 | } |
| 6049 | |
| 6050 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 6051 | unsigned int res) |
| 6052 | { |
| 6053 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6054 | alc260_hp_3013_automute(codec); |
| 6055 | } |
| 6056 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6057 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 6058 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6059 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6060 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6061 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6062 | bits); |
| 6063 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6064 | bits); |
| 6065 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6066 | bits); |
| 6067 | } |
| 6068 | |
| 6069 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 6070 | unsigned int res) |
| 6071 | { |
| 6072 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6073 | alc260_hp_3012_automute(codec); |
| 6074 | } |
| 6075 | |
| 6076 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6077 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6078 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6079 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6080 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6081 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6082 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6083 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6084 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6085 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6086 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6087 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6088 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6089 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6090 | { } /* end */ |
| 6091 | }; |
| 6092 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6093 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6094 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6095 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6096 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6097 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6098 | * revisions available in early 2006. Therefore for now allow the |
| 6099 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6100 | * that the lack of mic bias for this NID is intentional we could change the |
| 6101 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6102 | * |
| 6103 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6104 | * don't appear to make the mic bias available from the "line" jack, even |
| 6105 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6106 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6107 | * and the output jack. If this turns out to be the case for all such |
| 6108 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6109 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6110 | * |
| 6111 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6112 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6113 | * controls for such models. On models without a "mono speaker" the control |
| 6114 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6115 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6116 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6117 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6118 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6119 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6120 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6121 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6122 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6123 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6124 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6125 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6126 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6127 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6128 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6129 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6130 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6131 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6132 | { } /* end */ |
| 6133 | }; |
| 6134 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6135 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6136 | */ |
| 6137 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6138 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6139 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6140 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6141 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6142 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6143 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6144 | { } /* end */ |
| 6145 | }; |
| 6146 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6147 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6148 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6149 | */ |
| 6150 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6151 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6152 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6153 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6154 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6155 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6156 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6157 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6158 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6159 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6160 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6161 | { } /* end */ |
| 6162 | }; |
| 6163 | |
| 6164 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6165 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6166 | */ |
| 6167 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6168 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6169 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6170 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6171 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6172 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6173 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6174 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6175 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6176 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6177 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6178 | { } /* end */ |
| 6179 | }; |
| 6180 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6181 | /* |
| 6182 | * initialization verbs |
| 6183 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6184 | static struct hda_verb alc260_init_verbs[] = { |
| 6185 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6186 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6187 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6188 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6189 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6190 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6191 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6192 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6193 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6194 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6195 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6196 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6197 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6198 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6199 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6200 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6201 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6202 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6203 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6204 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6205 | /* set connection select to line in (default select for this ADC) */ |
| 6206 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6207 | /* mute capture amp left and right */ |
| 6208 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6209 | /* set connection select to line in (default select for this ADC) */ |
| 6210 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6211 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6212 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6213 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6214 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6215 | /* set vol=0 HP mixer amp left and right */ |
| 6216 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6217 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6218 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6219 | /* set vol=0 Mono mixer amp left and right */ |
| 6220 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6221 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6222 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6223 | /* unmute LINE-2 out pin */ |
| 6224 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6225 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6226 | * Line In 2 = 0x03 |
| 6227 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6228 | /* mute analog inputs */ |
| 6229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6231 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6232 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6233 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6234 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6235 | /* mute Front out path */ |
| 6236 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6237 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6238 | /* mute Headphone out path */ |
| 6239 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6240 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6241 | /* mute Mono out path */ |
| 6242 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6243 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6244 | { } |
| 6245 | }; |
| 6246 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6247 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6248 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6249 | /* Headphone and output */ |
| 6250 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6251 | /* mono output */ |
| 6252 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6253 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6254 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6255 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6256 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6257 | /* Line In pin widget for input */ |
| 6258 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6259 | /* Line-2 pin widget for output */ |
| 6260 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6261 | /* CD pin widget for input */ |
| 6262 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6263 | /* unmute amp left and right */ |
| 6264 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6265 | /* set connection select to line in (default select for this ADC) */ |
| 6266 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6267 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6268 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6269 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6270 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6271 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6272 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6273 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6274 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6275 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6276 | * Line In 2 = 0x03 |
| 6277 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6278 | /* mute analog inputs */ |
| 6279 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6281 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6282 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6283 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6284 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6285 | /* Unmute Front out path */ |
| 6286 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6287 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6288 | /* Unmute Headphone out path */ |
| 6289 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6290 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6291 | /* Unmute Mono out path */ |
| 6292 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6293 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6294 | { } |
| 6295 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6296 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6297 | |
| 6298 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6299 | /* Line out and output */ |
| 6300 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6301 | /* mono output */ |
| 6302 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6303 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6304 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6305 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6306 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6307 | /* Line In pin widget for input */ |
| 6308 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6309 | /* Headphone pin widget for output */ |
| 6310 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6311 | /* CD pin widget for input */ |
| 6312 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6313 | /* unmute amp left and right */ |
| 6314 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6315 | /* set connection select to line in (default select for this ADC) */ |
| 6316 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6317 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6318 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6319 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6320 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6321 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6322 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6323 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6324 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6325 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6326 | * Line In 2 = 0x03 |
| 6327 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6328 | /* mute analog inputs */ |
| 6329 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6330 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6331 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6334 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6335 | /* Unmute Front out path */ |
| 6336 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6337 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6338 | /* Unmute Headphone out path */ |
| 6339 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6340 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6341 | /* Unmute Mono out path */ |
| 6342 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6343 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6344 | { } |
| 6345 | }; |
| 6346 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6347 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6348 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6349 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6350 | */ |
| 6351 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6352 | /* Disable all GPIOs */ |
| 6353 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6354 | /* Internal speaker is connected to headphone pin */ |
| 6355 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6356 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6357 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6358 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6359 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6360 | /* Ensure all other unused pins are disabled and muted. */ |
| 6361 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6362 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6363 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6364 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6365 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6366 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6367 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6368 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6369 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6370 | /* Disable digital (SPDIF) pins */ |
| 6371 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6372 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6373 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6374 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6375 | * when acting as an output. |
| 6376 | */ |
| 6377 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6378 | |
| 6379 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6380 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6381 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6382 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6383 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6384 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6385 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6386 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6387 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6388 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6389 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6390 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6391 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6392 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6393 | * If the pin mode is changed by the user the pin mode control will |
| 6394 | * take care of enabling the pin's input/output buffers as needed. |
| 6395 | * Therefore there's no need to enable the input buffer at this |
| 6396 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6397 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6398 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6399 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6400 | * mixer ctrl) |
| 6401 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6402 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6403 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6404 | /* Mute capture amp left and right */ |
| 6405 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6406 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6407 | * in (on mic1 pin) |
| 6408 | */ |
| 6409 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6410 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6411 | /* Do the same for the second ADC: mute capture input amp and |
| 6412 | * set ADC connection to line in (on mic1 pin) |
| 6413 | */ |
| 6414 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6415 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6416 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6417 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6418 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6419 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6420 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6421 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6422 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6423 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6424 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6425 | {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] | 6426 | |
| 6427 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6428 | }; |
| 6429 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6430 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6431 | * similar laptops (adapted from Fujitsu init verbs). |
| 6432 | */ |
| 6433 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6434 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6435 | * the headphone jack. Turn this on and rely on the standard mute |
| 6436 | * methods whenever the user wants to turn these outputs off. |
| 6437 | */ |
| 6438 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6439 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6440 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6441 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6442 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6443 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6444 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6445 | /* Line In jack is connected to Line1 pin */ |
| 6446 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6447 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6448 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6449 | /* Ensure all other unused pins are disabled and muted. */ |
| 6450 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6451 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6452 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6453 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6454 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6455 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6456 | /* Disable digital (SPDIF) pins */ |
| 6457 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6458 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6459 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6460 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6461 | * bus when acting as outputs. |
| 6462 | */ |
| 6463 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6464 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6465 | |
| 6466 | /* Start with output sum widgets muted and their output gains at min */ |
| 6467 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6468 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6469 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6470 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6471 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6472 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6473 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6474 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6475 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6476 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6477 | /* Unmute Line-out pin widget amp left and right |
| 6478 | * (no equiv mixer ctrl) |
| 6479 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6480 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6481 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6482 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6483 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6484 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6485 | * will take care of enabling the pin's input/output buffers as needed. |
| 6486 | * Therefore there's no need to enable the input buffer at this |
| 6487 | * stage. |
| 6488 | */ |
| 6489 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6490 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6491 | |
| 6492 | /* Mute capture amp left and right */ |
| 6493 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6494 | /* Set ADC connection select to match default mixer setting - mic |
| 6495 | * (on mic1 pin) |
| 6496 | */ |
| 6497 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6498 | |
| 6499 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6500 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6501 | */ |
| 6502 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6503 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6504 | |
| 6505 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6506 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6508 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6509 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6510 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6511 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6512 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6513 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6514 | |
| 6515 | { } |
| 6516 | }; |
| 6517 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6518 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6519 | * (adapted from Acer init verbs). |
| 6520 | */ |
| 6521 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6522 | /* GPIO 0 enables the output jack. |
| 6523 | * Turn this on and rely on the standard mute |
| 6524 | * methods whenever the user wants to turn these outputs off. |
| 6525 | */ |
| 6526 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6527 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6528 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6529 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6530 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6531 | /* Ensure all other unused pins are disabled and muted. */ |
| 6532 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6533 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6534 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6535 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6536 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6537 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6538 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6539 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6540 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6541 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6542 | /* Disable digital (SPDIF) pins */ |
| 6543 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6544 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6545 | |
| 6546 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6547 | * bus when acting as outputs. |
| 6548 | */ |
| 6549 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6550 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6551 | |
| 6552 | /* Start with output sum widgets muted and their output gains at min */ |
| 6553 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6554 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6555 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6556 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6557 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6558 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6559 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6560 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6561 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6562 | |
| 6563 | /* Unmute Line-out pin widget amp left and right |
| 6564 | * (no equiv mixer ctrl) |
| 6565 | */ |
| 6566 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6567 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6568 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6569 | * will take care of enabling the pin's input/output buffers as needed. |
| 6570 | * Therefore there's no need to enable the input buffer at this |
| 6571 | * stage. |
| 6572 | */ |
| 6573 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6574 | |
| 6575 | /* Mute capture amp left and right */ |
| 6576 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6577 | /* Set ADC connection select to match default mixer setting - mic |
| 6578 | * (on mic1 pin) |
| 6579 | */ |
| 6580 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6581 | |
| 6582 | /* Do similar with the second ADC: mute capture input amp and |
| 6583 | * set ADC connection to mic to match ALSA's default state. |
| 6584 | */ |
| 6585 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6586 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6587 | |
| 6588 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6589 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6591 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6592 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6593 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6594 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6595 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6596 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6597 | |
| 6598 | { } |
| 6599 | }; |
| 6600 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6601 | static struct hda_verb alc260_will_verbs[] = { |
| 6602 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6603 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6604 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6605 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6606 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6607 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6608 | {} |
| 6609 | }; |
| 6610 | |
| 6611 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6612 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6613 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6614 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6615 | |
| 6616 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6617 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6618 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6619 | |
| 6620 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6621 | {} |
| 6622 | }; |
| 6623 | |
| 6624 | /* toggle speaker-output according to the hp-jack state */ |
| 6625 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6626 | { |
| 6627 | unsigned int present; |
| 6628 | |
| 6629 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6630 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6631 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6632 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6633 | AC_VERB_SET_GPIO_DATA, 1); |
| 6634 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6635 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6636 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6637 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6638 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6639 | AC_VERB_SET_GPIO_DATA, 0); |
| 6640 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6641 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6642 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6643 | } |
| 6644 | } |
| 6645 | |
| 6646 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6647 | unsigned int res) |
| 6648 | { |
| 6649 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6650 | alc260_replacer_672v_automute(codec); |
| 6651 | } |
| 6652 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6653 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6654 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6655 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6656 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6657 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6658 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6659 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6660 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6661 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6662 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6663 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6664 | {} |
| 6665 | }; |
| 6666 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6667 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6668 | * configuration. |
| 6669 | */ |
| 6670 | #ifdef CONFIG_SND_DEBUG |
| 6671 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6672 | 0x02, |
| 6673 | }; |
| 6674 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6675 | 0x04, 0x05, |
| 6676 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6677 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6678 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6679 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6680 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6681 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6682 | { |
| 6683 | .num_items = 7, |
| 6684 | .items = { |
| 6685 | { "MIC1 pin", 0x0 }, |
| 6686 | { "MIC2 pin", 0x1 }, |
| 6687 | { "LINE1 pin", 0x2 }, |
| 6688 | { "LINE2 pin", 0x3 }, |
| 6689 | { "CD pin", 0x4 }, |
| 6690 | { "LINE-OUT pin", 0x5 }, |
| 6691 | { "HP-OUT pin", 0x6 }, |
| 6692 | }, |
| 6693 | }, |
| 6694 | { |
| 6695 | .num_items = 8, |
| 6696 | .items = { |
| 6697 | { "MIC1 pin", 0x0 }, |
| 6698 | { "MIC2 pin", 0x1 }, |
| 6699 | { "LINE1 pin", 0x2 }, |
| 6700 | { "LINE2 pin", 0x3 }, |
| 6701 | { "CD pin", 0x4 }, |
| 6702 | { "Mixer", 0x5 }, |
| 6703 | { "LINE-OUT pin", 0x6 }, |
| 6704 | { "HP-OUT pin", 0x7 }, |
| 6705 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6706 | }, |
| 6707 | }; |
| 6708 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6709 | /* Output driver widgets */ |
| 6710 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6711 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6712 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6713 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6714 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6715 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6716 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6717 | /* Modes for retasking pin widgets |
| 6718 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6719 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6720 | * mention this restriction. At this stage it's not clear whether |
| 6721 | * this behaviour is intentional or is a hardware bug in chip |
| 6722 | * revisions available at least up until early 2006. Therefore for |
| 6723 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6724 | * choices, but if it turns out that the lack of mic bias for these |
| 6725 | * NIDs is intentional we could change their modes from |
| 6726 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6727 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6728 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6729 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6730 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6731 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6732 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6733 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6734 | |
| 6735 | /* Loopback mixer controls */ |
| 6736 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6737 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6738 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6739 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6740 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6741 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6742 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6743 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6744 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6745 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6746 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6747 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6748 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6749 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6750 | |
| 6751 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6752 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6753 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6754 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6755 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6756 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6757 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6758 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6759 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6760 | */ |
| 6761 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6762 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6763 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6764 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6765 | * this output to turn on an external amplifier. |
| 6766 | */ |
| 6767 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6768 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6769 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6770 | { } /* end */ |
| 6771 | }; |
| 6772 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6773 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6774 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6775 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6776 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6777 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6778 | /* Enable retasking pins as output, initially without power amp */ |
| 6779 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6780 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6781 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6782 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6783 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6784 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6785 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6786 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6787 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6788 | * payload also sets the generation to 0, output to be in "consumer" |
| 6789 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6790 | * control. |
| 6791 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6792 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6793 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6794 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6795 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6796 | * OUT1 sum bus when acting as an output. |
| 6797 | */ |
| 6798 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6799 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6800 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6801 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6802 | |
| 6803 | /* Start with output sum widgets muted and their output gains at min */ |
| 6804 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6805 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6806 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6807 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6808 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6809 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6810 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6811 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6812 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6813 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6814 | /* Unmute retasking pin widget output buffers since the default |
| 6815 | * state appears to be output. As the pin mode is changed by the |
| 6816 | * user the pin mode control will take care of enabling the pin's |
| 6817 | * input/output buffers as needed. |
| 6818 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6819 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6820 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6821 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6822 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6823 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6824 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6825 | /* Also unmute the mono-out pin widget */ |
| 6826 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6827 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6828 | /* Mute capture amp left and right */ |
| 6829 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6830 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6831 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6832 | */ |
| 6833 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6834 | |
| 6835 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6836 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6837 | */ |
| 6838 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6839 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6840 | |
| 6841 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6842 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6843 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6844 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6845 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6846 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6847 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6848 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6849 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6850 | |
| 6851 | { } |
| 6852 | }; |
| 6853 | #endif |
| 6854 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6855 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6856 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6857 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6858 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6859 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6860 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6861 | /* |
| 6862 | * for BIOS auto-configuration |
| 6863 | */ |
| 6864 | |
| 6865 | 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] | 6866 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6867 | { |
| 6868 | hda_nid_t nid_vol; |
| 6869 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6870 | int err; |
| 6871 | |
| 6872 | if (nid >= 0x0f && nid < 0x11) { |
| 6873 | nid_vol = nid - 0x7; |
| 6874 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6875 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6876 | } else if (nid == 0x11) { |
| 6877 | nid_vol = nid - 0x7; |
| 6878 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6879 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6880 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6881 | nid_vol = 0x08; |
| 6882 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6883 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6884 | } else |
| 6885 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6886 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6887 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6888 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6889 | 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] | 6890 | if (err < 0) |
| 6891 | return err; |
| 6892 | *vol_bits |= (1 << nid_vol); |
| 6893 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6894 | 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] | 6895 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6896 | return err; |
| 6897 | return 1; |
| 6898 | } |
| 6899 | |
| 6900 | /* add playback controls from the parsed DAC table */ |
| 6901 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6902 | const struct auto_pin_cfg *cfg) |
| 6903 | { |
| 6904 | hda_nid_t nid; |
| 6905 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6906 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6907 | |
| 6908 | spec->multiout.num_dacs = 1; |
| 6909 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6910 | spec->multiout.dac_nids[0] = 0x02; |
| 6911 | |
| 6912 | nid = cfg->line_out_pins[0]; |
| 6913 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6914 | const char *pfx; |
| 6915 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6916 | pfx = "Master"; |
| 6917 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6918 | pfx = "Speaker"; |
| 6919 | else |
| 6920 | pfx = "Front"; |
| 6921 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6922 | if (err < 0) |
| 6923 | return err; |
| 6924 | } |
| 6925 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6926 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6927 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6928 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6929 | if (err < 0) |
| 6930 | return err; |
| 6931 | } |
| 6932 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6933 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6934 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6935 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6936 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6937 | if (err < 0) |
| 6938 | return err; |
| 6939 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6940 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6941 | } |
| 6942 | |
| 6943 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6944 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6945 | const struct auto_pin_cfg *cfg) |
| 6946 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6947 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6948 | } |
| 6949 | |
| 6950 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6951 | hda_nid_t nid, int pin_type, |
| 6952 | int sel_idx) |
| 6953 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6954 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6955 | /* need the manual connection? */ |
| 6956 | if (nid >= 0x12) { |
| 6957 | int idx = nid - 0x12; |
| 6958 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6959 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6960 | } |
| 6961 | } |
| 6962 | |
| 6963 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6964 | { |
| 6965 | struct alc_spec *spec = codec->spec; |
| 6966 | hda_nid_t nid; |
| 6967 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6968 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6969 | if (nid) { |
| 6970 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6971 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6972 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6973 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6974 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6975 | if (nid) |
| 6976 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6977 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6978 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6979 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6980 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6981 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6982 | |
| 6983 | #define ALC260_PIN_CD_NID 0x16 |
| 6984 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6985 | { |
| 6986 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6987 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6988 | int i; |
| 6989 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6990 | for (i = 0; i < cfg->num_inputs; i++) { |
| 6991 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6992 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 6993 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6994 | if (nid != ALC260_PIN_CD_NID && |
| 6995 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6996 | snd_hda_codec_write(codec, nid, 0, |
| 6997 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6998 | AMP_OUT_MUTE); |
| 6999 | } |
| 7000 | } |
| 7001 | } |
| 7002 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7003 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7004 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7005 | /* |
| 7006 | * generic initialization of ADC, input mixers and output mixers |
| 7007 | */ |
| 7008 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 7009 | /* |
| 7010 | * Unmute ADC0-1 and set the default input to mic-in |
| 7011 | */ |
| 7012 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7013 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7014 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7015 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7016 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7017 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7018 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7019 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7020 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7021 | */ |
| 7022 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7023 | /* mute analog inputs */ |
| 7024 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7025 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7026 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7027 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7028 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7029 | |
| 7030 | /* |
| 7031 | * Set up output mixers (0x08 - 0x0a) |
| 7032 | */ |
| 7033 | /* set vol=0 to output mixers */ |
| 7034 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7035 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7036 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7037 | /* set up input amps for analog loopback */ |
| 7038 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7039 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7040 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7041 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7042 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7043 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7044 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7045 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7046 | { } |
| 7047 | }; |
| 7048 | |
| 7049 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7050 | { |
| 7051 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7052 | int err; |
| 7053 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7054 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7055 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7056 | alc260_ignore); |
| 7057 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7058 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7059 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7060 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7061 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7062 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7063 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7064 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7065 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7066 | return err; |
| 7067 | |
| 7068 | spec->multiout.max_channels = 2; |
| 7069 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7070 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7071 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7072 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7073 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7074 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7075 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7076 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7077 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7078 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7079 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7080 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7081 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7082 | return 1; |
| 7083 | } |
| 7084 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7085 | /* additional initialization for auto-configuration model */ |
| 7086 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7087 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7088 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7089 | alc260_auto_init_multi_out(codec); |
| 7090 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7091 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7092 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7093 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7094 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7095 | } |
| 7096 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7097 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7098 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7099 | { 0x07, HDA_INPUT, 0 }, |
| 7100 | { 0x07, HDA_INPUT, 1 }, |
| 7101 | { 0x07, HDA_INPUT, 2 }, |
| 7102 | { 0x07, HDA_INPUT, 3 }, |
| 7103 | { 0x07, HDA_INPUT, 4 }, |
| 7104 | { } /* end */ |
| 7105 | }; |
| 7106 | #endif |
| 7107 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7108 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7109 | * Pin config fixes |
| 7110 | */ |
| 7111 | enum { |
| 7112 | PINFIX_HP_DC5750, |
| 7113 | }; |
| 7114 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7115 | static const struct alc_fixup alc260_fixups[] = { |
| 7116 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7117 | .type = ALC_FIXUP_PINS, |
| 7118 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7119 | { 0x11, 0x90130110 }, /* speaker */ |
| 7120 | { } |
| 7121 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7122 | }, |
| 7123 | }; |
| 7124 | |
| 7125 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7126 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7127 | {} |
| 7128 | }; |
| 7129 | |
| 7130 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7131 | * ALC260 configurations |
| 7132 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7133 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7134 | [ALC260_BASIC] = "basic", |
| 7135 | [ALC260_HP] = "hp", |
| 7136 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7137 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7138 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7139 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7140 | [ALC260_WILL] = "will", |
| 7141 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7142 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7143 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7144 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7145 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7146 | [ALC260_AUTO] = "auto", |
| 7147 | }; |
| 7148 | |
| 7149 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7150 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7151 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7152 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7153 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7154 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7155 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7156 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7157 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7158 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7159 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7160 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7161 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7162 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7163 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7164 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7165 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7166 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7167 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7168 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7169 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7170 | {} |
| 7171 | }; |
| 7172 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7173 | static struct alc_config_preset alc260_presets[] = { |
| 7174 | [ALC260_BASIC] = { |
| 7175 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7176 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7177 | .init_verbs = { alc260_init_verbs }, |
| 7178 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7179 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7180 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7181 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7182 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7183 | .channel_mode = alc260_modes, |
| 7184 | .input_mux = &alc260_capture_source, |
| 7185 | }, |
| 7186 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7187 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7188 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7189 | .init_verbs = { alc260_init_verbs, |
| 7190 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7191 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7192 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7193 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7194 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7195 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7196 | .channel_mode = alc260_modes, |
| 7197 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7198 | .unsol_event = alc260_hp_unsol_event, |
| 7199 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7200 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7201 | [ALC260_HP_DC7600] = { |
| 7202 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7203 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7204 | .init_verbs = { alc260_init_verbs, |
| 7205 | alc260_hp_dc7600_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_adc_nids_alt), |
| 7209 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7210 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7211 | .channel_mode = alc260_modes, |
| 7212 | .input_mux = &alc260_capture_source, |
| 7213 | .unsol_event = alc260_hp_3012_unsol_event, |
| 7214 | .init_hook = alc260_hp_3012_automute, |
| 7215 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7216 | [ALC260_HP_3013] = { |
| 7217 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7218 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7219 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7220 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7221 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7222 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7223 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7224 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7225 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7226 | .channel_mode = alc260_modes, |
| 7227 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7228 | .unsol_event = alc260_hp_3013_unsol_event, |
| 7229 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7230 | }, |
| 7231 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7232 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7233 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7234 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7235 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7236 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7237 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7238 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7239 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7240 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7241 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7242 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7243 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7244 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7245 | .init_verbs = { alc260_acer_init_verbs }, |
| 7246 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7247 | .dac_nids = alc260_dac_nids, |
| 7248 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7249 | .adc_nids = alc260_dual_adc_nids, |
| 7250 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7251 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7252 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7253 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7254 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7255 | [ALC260_FAVORIT100] = { |
| 7256 | .mixers = { alc260_favorit100_mixer }, |
| 7257 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7258 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7259 | .dac_nids = alc260_dac_nids, |
| 7260 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7261 | .adc_nids = alc260_dual_adc_nids, |
| 7262 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7263 | .channel_mode = alc260_modes, |
| 7264 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7265 | .input_mux = alc260_favorit100_capture_sources, |
| 7266 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7267 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7268 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7269 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7270 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7271 | .dac_nids = alc260_dac_nids, |
| 7272 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7273 | .adc_nids = alc260_adc_nids, |
| 7274 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7275 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7276 | .channel_mode = alc260_modes, |
| 7277 | .input_mux = &alc260_capture_source, |
| 7278 | }, |
| 7279 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7280 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7281 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7282 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7283 | .dac_nids = alc260_dac_nids, |
| 7284 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7285 | .adc_nids = alc260_adc_nids, |
| 7286 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7287 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7288 | .channel_mode = alc260_modes, |
| 7289 | .input_mux = &alc260_capture_source, |
| 7290 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7291 | .init_hook = alc260_replacer_672v_automute, |
| 7292 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7293 | #ifdef CONFIG_SND_DEBUG |
| 7294 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7295 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7296 | .init_verbs = { alc260_test_init_verbs }, |
| 7297 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7298 | .dac_nids = alc260_test_dac_nids, |
| 7299 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7300 | .adc_nids = alc260_test_adc_nids, |
| 7301 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7302 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7303 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7304 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7305 | }, |
| 7306 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7307 | }; |
| 7308 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7309 | static int patch_alc260(struct hda_codec *codec) |
| 7310 | { |
| 7311 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7312 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7313 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7314 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7315 | if (spec == NULL) |
| 7316 | return -ENOMEM; |
| 7317 | |
| 7318 | codec->spec = spec; |
| 7319 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7320 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7321 | alc260_models, |
| 7322 | alc260_cfg_tbl); |
| 7323 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7324 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7325 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7326 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7327 | } |
| 7328 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7329 | if (board_config == ALC260_AUTO) { |
| 7330 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7331 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7332 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7333 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7334 | if (board_config == ALC260_AUTO) { |
| 7335 | /* automatic parse from the BIOS config */ |
| 7336 | err = alc260_parse_auto_config(codec); |
| 7337 | if (err < 0) { |
| 7338 | alc_free(codec); |
| 7339 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7340 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7341 | printk(KERN_INFO |
| 7342 | "hda_codec: Cannot set up configuration " |
| 7343 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7344 | board_config = ALC260_BASIC; |
| 7345 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7346 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7347 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7348 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7349 | if (err < 0) { |
| 7350 | alc_free(codec); |
| 7351 | return err; |
| 7352 | } |
| 7353 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7354 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7355 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7356 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7357 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7358 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7359 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7360 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7361 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7362 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7363 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7364 | if (!spec->adc_nids && spec->input_mux) { |
| 7365 | /* check whether NID 0x04 is valid */ |
| 7366 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7367 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7368 | /* get type */ |
| 7369 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7370 | spec->adc_nids = alc260_adc_nids_alt; |
| 7371 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7372 | } else { |
| 7373 | spec->adc_nids = alc260_adc_nids; |
| 7374 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7375 | } |
| 7376 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7377 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7378 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7379 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7380 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7381 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7382 | spec->vmaster_nid = 0x08; |
| 7383 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7384 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7385 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7386 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7387 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7388 | if (!spec->loopback.amplist) |
| 7389 | spec->loopback.amplist = alc260_loopbacks; |
| 7390 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7391 | |
| 7392 | return 0; |
| 7393 | } |
| 7394 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7395 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7396 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7397 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7398 | * |
| 7399 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7400 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7401 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7402 | * 6-channel independent captures. |
| 7403 | * |
| 7404 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7405 | * driver yet). |
| 7406 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7407 | #define ALC882_DIGOUT_NID 0x06 |
| 7408 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7409 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7410 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7411 | #define ALC1200_DIGOUT_NID 0x10 |
| 7412 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7413 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7414 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7415 | { 8, NULL } |
| 7416 | }; |
| 7417 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7418 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7419 | static hda_nid_t alc882_dac_nids[4] = { |
| 7420 | /* front, rear, clfe, rear_surr */ |
| 7421 | 0x02, 0x03, 0x04, 0x05 |
| 7422 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7423 | #define alc883_dac_nids alc882_dac_nids |
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 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7426 | #define alc882_adc_nids alc880_adc_nids |
| 7427 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7428 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7429 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7430 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7431 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7432 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7433 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7434 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7435 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7436 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7437 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7438 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7439 | /* input MUX */ |
| 7440 | /* FIXME: should be a matrix-type input source selection */ |
| 7441 | |
| 7442 | static struct hda_input_mux alc882_capture_source = { |
| 7443 | .num_items = 4, |
| 7444 | .items = { |
| 7445 | { "Mic", 0x0 }, |
| 7446 | { "Front Mic", 0x1 }, |
| 7447 | { "Line", 0x2 }, |
| 7448 | { "CD", 0x4 }, |
| 7449 | }, |
| 7450 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7451 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7452 | #define alc883_capture_source alc882_capture_source |
| 7453 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7454 | static struct hda_input_mux alc889_capture_source = { |
| 7455 | .num_items = 3, |
| 7456 | .items = { |
| 7457 | { "Front Mic", 0x0 }, |
| 7458 | { "Mic", 0x3 }, |
| 7459 | { "Line", 0x2 }, |
| 7460 | }, |
| 7461 | }; |
| 7462 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7463 | static struct hda_input_mux mb5_capture_source = { |
| 7464 | .num_items = 3, |
| 7465 | .items = { |
| 7466 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7467 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7468 | { "CD", 0x4 }, |
| 7469 | }, |
| 7470 | }; |
| 7471 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7472 | static struct hda_input_mux macmini3_capture_source = { |
| 7473 | .num_items = 2, |
| 7474 | .items = { |
| 7475 | { "Line", 0x2 }, |
| 7476 | { "CD", 0x4 }, |
| 7477 | }, |
| 7478 | }; |
| 7479 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7480 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7481 | .num_items = 4, |
| 7482 | .items = { |
| 7483 | { "Mic", 0x1 }, |
| 7484 | { "Front Mic", 0x0 }, |
| 7485 | { "Line", 0x2 }, |
| 7486 | { "CD", 0x4 }, |
| 7487 | }, |
| 7488 | }; |
| 7489 | |
| 7490 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7491 | .num_items = 2, |
| 7492 | .items = { |
| 7493 | { "Mic", 0x1 }, |
| 7494 | { "Line", 0x2 }, |
| 7495 | }, |
| 7496 | }; |
| 7497 | |
| 7498 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7499 | .num_items = 4, |
| 7500 | .items = { |
| 7501 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7502 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7503 | { "Line", 0x2 }, |
| 7504 | { "CD", 0x4 }, |
| 7505 | }, |
| 7506 | }; |
| 7507 | |
| 7508 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7509 | .num_items = 2, |
| 7510 | .items = { |
| 7511 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7512 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7513 | }, |
| 7514 | }; |
| 7515 | |
| 7516 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7517 | .num_items = 3, |
| 7518 | .items = { |
| 7519 | { "Mic", 0x0 }, |
| 7520 | { "Front Mic", 0x1 }, |
| 7521 | { "Line", 0x4 }, |
| 7522 | }, |
| 7523 | }; |
| 7524 | |
| 7525 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7526 | .num_items = 2, |
| 7527 | .items = { |
| 7528 | { "Mic", 0x0 }, |
| 7529 | { "Line", 0x2 }, |
| 7530 | }, |
| 7531 | }; |
| 7532 | |
| 7533 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7534 | .num_items = 2, |
| 7535 | .items = { |
| 7536 | { "Mic", 0x0 }, |
| 7537 | /* Front Mic (0x01) unused */ |
| 7538 | { "Line", 0x2 }, |
| 7539 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7540 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7541 | }, |
| 7542 | }; |
| 7543 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7544 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7545 | .num_items = 2, |
| 7546 | .items = { |
| 7547 | { "Mic", 0x01 }, |
| 7548 | { "Line", 0x2 }, /* Not sure! */ |
| 7549 | }, |
| 7550 | }; |
| 7551 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7552 | /* |
| 7553 | * 2ch mode |
| 7554 | */ |
| 7555 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7556 | { 2, NULL } |
| 7557 | }; |
| 7558 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7559 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7560 | * 2ch mode |
| 7561 | */ |
| 7562 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7563 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7564 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7565 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7566 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7567 | { } /* end */ |
| 7568 | }; |
| 7569 | |
| 7570 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7571 | * 4ch mode |
| 7572 | */ |
| 7573 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7574 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7575 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7576 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7577 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7578 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7579 | { } /* end */ |
| 7580 | }; |
| 7581 | |
| 7582 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7583 | * 6ch mode |
| 7584 | */ |
| 7585 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7586 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7587 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7588 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7589 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7590 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7591 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7592 | { } /* end */ |
| 7593 | }; |
| 7594 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7595 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7596 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7597 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7598 | { 6, alc882_3ST_ch6_init }, |
| 7599 | }; |
| 7600 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7601 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7602 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7603 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7604 | * 2ch mode |
| 7605 | */ |
| 7606 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7607 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7608 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7609 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7610 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7611 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7612 | { } /* end */ |
| 7613 | }; |
| 7614 | |
| 7615 | /* |
| 7616 | * 4ch mode |
| 7617 | */ |
| 7618 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7619 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7620 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7621 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7622 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7623 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7624 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7625 | { } /* end */ |
| 7626 | }; |
| 7627 | |
| 7628 | /* |
| 7629 | * 6ch mode |
| 7630 | */ |
| 7631 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7632 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7633 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7634 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7635 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7636 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7637 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7638 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7639 | { } /* end */ |
| 7640 | }; |
| 7641 | |
| 7642 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7643 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7644 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7645 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7646 | }; |
| 7647 | |
| 7648 | |
| 7649 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7650 | * 6ch mode |
| 7651 | */ |
| 7652 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7653 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7654 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7655 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7656 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7657 | { } /* end */ |
| 7658 | }; |
| 7659 | |
| 7660 | /* |
| 7661 | * 8ch mode |
| 7662 | */ |
| 7663 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7664 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7665 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7666 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7667 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7668 | { } /* end */ |
| 7669 | }; |
| 7670 | |
| 7671 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7672 | { 6, alc882_sixstack_ch6_init }, |
| 7673 | { 8, alc882_sixstack_ch8_init }, |
| 7674 | }; |
| 7675 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7676 | |
| 7677 | /* Macbook Air 2,1 */ |
| 7678 | |
| 7679 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7680 | { 2, NULL }, |
| 7681 | }; |
| 7682 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7683 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7684 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7685 | */ |
| 7686 | |
| 7687 | /* |
| 7688 | * 2ch mode |
| 7689 | */ |
| 7690 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7691 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7692 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7693 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7694 | { } /* end */ |
| 7695 | }; |
| 7696 | |
| 7697 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7698 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7699 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7700 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7701 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7702 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7703 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7704 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7705 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7706 | { } /* end */ |
| 7707 | }; |
| 7708 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7709 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7710 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7711 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7712 | }; |
| 7713 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7714 | /* |
| 7715 | * 2ch |
| 7716 | * Speakers/Woofer/HP = Front |
| 7717 | * LineIn = Input |
| 7718 | */ |
| 7719 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7720 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7721 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7722 | { } /* end */ |
| 7723 | }; |
| 7724 | |
| 7725 | /* |
| 7726 | * 6ch mode |
| 7727 | * Speakers/HP = Front |
| 7728 | * Woofer = LFE |
| 7729 | * LineIn = Surround |
| 7730 | */ |
| 7731 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7732 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7733 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7734 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7735 | { } /* end */ |
| 7736 | }; |
| 7737 | |
| 7738 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7739 | { 2, alc885_mb5_ch2_init }, |
| 7740 | { 6, alc885_mb5_ch6_init }, |
| 7741 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7742 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7743 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7744 | |
| 7745 | /* |
| 7746 | * 2ch mode |
| 7747 | */ |
| 7748 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7749 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7750 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7751 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7752 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7753 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7754 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7755 | { } /* end */ |
| 7756 | }; |
| 7757 | |
| 7758 | /* |
| 7759 | * 4ch mode |
| 7760 | */ |
| 7761 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7762 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7763 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7764 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7765 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7766 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7767 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7768 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7769 | { } /* end */ |
| 7770 | }; |
| 7771 | |
| 7772 | /* |
| 7773 | * 6ch mode |
| 7774 | */ |
| 7775 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7776 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7777 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7778 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7779 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7780 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7781 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7782 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7783 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7784 | { } /* end */ |
| 7785 | }; |
| 7786 | |
| 7787 | /* |
| 7788 | * 8ch mode |
| 7789 | */ |
| 7790 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7791 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7792 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7793 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7794 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7795 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7796 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7797 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7798 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7799 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7800 | { } /* end */ |
| 7801 | }; |
| 7802 | |
| 7803 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7804 | { 2, alc883_4ST_ch2_init }, |
| 7805 | { 4, alc883_4ST_ch4_init }, |
| 7806 | { 6, alc883_4ST_ch6_init }, |
| 7807 | { 8, alc883_4ST_ch8_init }, |
| 7808 | }; |
| 7809 | |
| 7810 | |
| 7811 | /* |
| 7812 | * 2ch mode |
| 7813 | */ |
| 7814 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7815 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7816 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7817 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7818 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7819 | { } /* end */ |
| 7820 | }; |
| 7821 | |
| 7822 | /* |
| 7823 | * 4ch mode |
| 7824 | */ |
| 7825 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7826 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7827 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7828 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7829 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7830 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7831 | { } /* end */ |
| 7832 | }; |
| 7833 | |
| 7834 | /* |
| 7835 | * 6ch mode |
| 7836 | */ |
| 7837 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7838 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7839 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7840 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7841 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7842 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7843 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7844 | { } /* end */ |
| 7845 | }; |
| 7846 | |
| 7847 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7848 | { 2, alc883_3ST_ch2_intel_init }, |
| 7849 | { 4, alc883_3ST_ch4_intel_init }, |
| 7850 | { 6, alc883_3ST_ch6_intel_init }, |
| 7851 | }; |
| 7852 | |
| 7853 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7854 | * 2ch mode |
| 7855 | */ |
| 7856 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7857 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7858 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7859 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7860 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7861 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7862 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7863 | { } /* end */ |
| 7864 | }; |
| 7865 | |
| 7866 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7867 | * 6ch mode |
| 7868 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7869 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7870 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7871 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7872 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7873 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7874 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7875 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7876 | { } /* end */ |
| 7877 | }; |
| 7878 | |
| 7879 | /* |
| 7880 | * 8ch mode |
| 7881 | */ |
| 7882 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7883 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7884 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7885 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7886 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7887 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7888 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7889 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7890 | { } /* end */ |
| 7891 | }; |
| 7892 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7893 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7894 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7895 | { 6, alc889_ch6_intel_init }, |
| 7896 | { 8, alc889_ch8_intel_init }, |
| 7897 | }; |
| 7898 | |
| 7899 | /* |
| 7900 | * 6ch mode |
| 7901 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7902 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7903 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7904 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7905 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7906 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7907 | { } /* end */ |
| 7908 | }; |
| 7909 | |
| 7910 | /* |
| 7911 | * 8ch mode |
| 7912 | */ |
| 7913 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7914 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7915 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7916 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7917 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7918 | { } /* end */ |
| 7919 | }; |
| 7920 | |
| 7921 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7922 | { 6, alc883_sixstack_ch6_init }, |
| 7923 | { 8, alc883_sixstack_ch8_init }, |
| 7924 | }; |
| 7925 | |
| 7926 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7927 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7928 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7929 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7930 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7931 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7932 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7933 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7934 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7935 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7936 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7937 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7938 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7939 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7940 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7941 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7942 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7943 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7944 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7945 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7946 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7947 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7948 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7949 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7950 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7951 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7952 | { } /* end */ |
| 7953 | }; |
| 7954 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7955 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7956 | |
| 7957 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7958 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7959 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7960 | { } |
| 7961 | }; |
| 7962 | |
| 7963 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7964 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7965 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7966 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7967 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7968 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7969 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7970 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7971 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7972 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7973 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7974 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 7975 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7976 | { } /* end */ |
| 7977 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7978 | |
| 7979 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7980 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7981 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7982 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7983 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7984 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7985 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7986 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7987 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7988 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7989 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7990 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7991 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7992 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 7993 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7994 | { } /* end */ |
| 7995 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7996 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7997 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7998 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7999 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8000 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8001 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8002 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8003 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8004 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8005 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8006 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8007 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8008 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8009 | { } /* end */ |
| 8010 | }; |
| 8011 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8012 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8013 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8014 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8015 | { } /* end */ |
| 8016 | }; |
| 8017 | |
| 8018 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8019 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 8020 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8021 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8022 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8023 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8024 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8025 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8026 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8027 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8028 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8029 | { } /* end */ |
| 8030 | }; |
| 8031 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8032 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 8033 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8034 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8035 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8036 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8037 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8039 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8040 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8041 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8042 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8043 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8044 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8045 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8046 | { } /* end */ |
| 8047 | }; |
| 8048 | |
| 8049 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8050 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8051 | */ |
| 8052 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8053 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8054 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8055 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8056 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8057 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8058 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8059 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8060 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8061 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8062 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8063 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8064 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8065 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8066 | { } /* end */ |
| 8067 | }; |
| 8068 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8069 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8070 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8071 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8072 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8073 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8074 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8075 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8076 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8077 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8078 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8079 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8080 | { } /* end */ |
| 8081 | }; |
| 8082 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8083 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8084 | { |
| 8085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8086 | .name = "Channel Mode", |
| 8087 | .info = alc_ch_mode_info, |
| 8088 | .get = alc_ch_mode_get, |
| 8089 | .put = alc_ch_mode_put, |
| 8090 | }, |
| 8091 | { } /* end */ |
| 8092 | }; |
| 8093 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8094 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8095 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8096 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8097 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8098 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8099 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8100 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8101 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8102 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8103 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8104 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8105 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8106 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8107 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8108 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8109 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8110 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8111 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8112 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8113 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8114 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8115 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8116 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8117 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8118 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8119 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8120 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8121 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8122 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8123 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8124 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8125 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8126 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8127 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8128 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8129 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8130 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8131 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8132 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8133 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8134 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8135 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8136 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8137 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8138 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8139 | |
| 8140 | /* FIXME: use matrix-type input source selection */ |
| 8141 | /* 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] | 8142 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8143 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8144 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8145 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8146 | /* ADC2: mute amp left and right */ |
| 8147 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8148 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8149 | /* ADC3: mute amp left and right */ |
| 8150 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8151 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8152 | |
| 8153 | { } |
| 8154 | }; |
| 8155 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8156 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8157 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8158 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8159 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8160 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8161 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8162 | /* ADC1: mute amp left and right */ |
| 8163 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8164 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8165 | { } |
| 8166 | }; |
| 8167 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8168 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8169 | /* change to EAPD mode */ |
| 8170 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8171 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8172 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8173 | }; |
| 8174 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8175 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8176 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8177 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8178 | { } |
| 8179 | }; |
| 8180 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8181 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8182 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8183 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8184 | {} |
| 8185 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8186 | |
| 8187 | static struct hda_verb alc885_init_verbs[] = { |
| 8188 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8189 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8191 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8192 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8193 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8194 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8195 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8196 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8197 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8198 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8199 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8200 | |
| 8201 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8202 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8203 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8204 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8205 | /* Front Pin: output 0 (0x0c) */ |
| 8206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8207 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8208 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8209 | /* Rear Pin: output 1 (0x0d) */ |
| 8210 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8211 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8212 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8213 | /* CLFE Pin: output 2 (0x0e) */ |
| 8214 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8215 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8216 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8217 | /* Side Pin: output 3 (0x0f) */ |
| 8218 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8219 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8220 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8221 | /* Mic (rear) pin: input vref at 80% */ |
| 8222 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8223 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8224 | /* Front Mic pin: input vref at 80% */ |
| 8225 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8226 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8227 | /* Line In pin: input */ |
| 8228 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8229 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8230 | |
| 8231 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8232 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8233 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8234 | /* Input mixer2 */ |
| 8235 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8236 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8237 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8238 | /* ADC2: mute amp left and right */ |
| 8239 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8240 | /* ADC3: mute amp left and right */ |
| 8241 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8242 | |
| 8243 | { } |
| 8244 | }; |
| 8245 | |
| 8246 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8247 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8248 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8249 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8250 | { } |
| 8251 | }; |
| 8252 | |
| 8253 | |
| 8254 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8255 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8256 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8257 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8258 | { } |
| 8259 | }; |
| 8260 | |
| 8261 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8262 | #define alc883_init_verbs alc882_base_init_verbs |
| 8263 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8264 | /* Mac Pro test */ |
| 8265 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8266 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8267 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8268 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8269 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8270 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8271 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8272 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8273 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8274 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8275 | { } /* end */ |
| 8276 | }; |
| 8277 | |
| 8278 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8279 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8280 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8281 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8282 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8283 | /* Front Pin: output 0 (0x0c) */ |
| 8284 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8285 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8286 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8287 | /* Front Mic pin: input vref at 80% */ |
| 8288 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8289 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8290 | /* Speaker: output */ |
| 8291 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8292 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8293 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8294 | /* Headphone output (output 0 - 0x0c) */ |
| 8295 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8296 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8297 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8298 | |
| 8299 | /* FIXME: use matrix-type input source selection */ |
| 8300 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8301 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8302 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8303 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8304 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8305 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8306 | /* Input mixer2 */ |
| 8307 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8308 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8309 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8310 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8311 | /* Input mixer3 */ |
| 8312 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8313 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8314 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8315 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8316 | /* ADC1: mute amp left and right */ |
| 8317 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8318 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8319 | /* ADC2: mute amp left and right */ |
| 8320 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8321 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8322 | /* ADC3: mute amp left and right */ |
| 8323 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8324 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8325 | |
| 8326 | { } |
| 8327 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8328 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8329 | /* Macbook 5,1 */ |
| 8330 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8331 | /* DACs */ |
| 8332 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8333 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8334 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8335 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8336 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8337 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8338 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8339 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8340 | /* Surround mixer */ |
| 8341 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8342 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8343 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8344 | /* LFE mixer */ |
| 8345 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8346 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8348 | /* HP mixer */ |
| 8349 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8350 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8351 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8352 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8353 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8354 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8355 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8356 | /* LFE Pin (0x0e) */ |
| 8357 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8358 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8359 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8360 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8361 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8362 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8363 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8364 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8365 | /* Front Mic pin: input vref at 80% */ |
| 8366 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8367 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8368 | /* Line In pin */ |
| 8369 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8370 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8371 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8372 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8373 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8374 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8375 | { } |
| 8376 | }; |
| 8377 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8378 | /* Macmini 3,1 */ |
| 8379 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8380 | /* DACs */ |
| 8381 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8382 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8383 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8384 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8385 | /* Front mixer */ |
| 8386 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8387 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8388 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8389 | /* Surround mixer */ |
| 8390 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8391 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8392 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8393 | /* LFE mixer */ |
| 8394 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8395 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8396 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8397 | /* HP mixer */ |
| 8398 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8399 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8400 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8401 | /* Front Pin (0x0c) */ |
| 8402 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8403 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8404 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8405 | /* LFE Pin (0x0e) */ |
| 8406 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8407 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8408 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8409 | /* HP Pin (0x0f) */ |
| 8410 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8411 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8412 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8413 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8414 | /* Line In pin */ |
| 8415 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8416 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8417 | |
| 8418 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8419 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8420 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8421 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8422 | { } |
| 8423 | }; |
| 8424 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8425 | |
| 8426 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8427 | /*Internal and HP Speaker Mixer*/ |
| 8428 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8429 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8431 | /*Internal Speaker Pin (0x0c)*/ |
| 8432 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8433 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8434 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8435 | /* HP Pin: output 0 (0x0e) */ |
| 8436 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8437 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8438 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8439 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8440 | /* Line in (is hp when jack connected)*/ |
| 8441 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8442 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8443 | |
| 8444 | { } |
| 8445 | }; |
| 8446 | |
| 8447 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8448 | /* Macbook Pro rev3 */ |
| 8449 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8450 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8451 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8452 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8453 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8454 | /* Rear mixer */ |
| 8455 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8456 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8457 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8458 | /* HP mixer */ |
| 8459 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8460 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8462 | /* Front Pin: output 0 (0x0c) */ |
| 8463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8464 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8465 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8466 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8467 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8468 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8469 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8470 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8471 | /* Mic (rear) pin: input vref at 80% */ |
| 8472 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8473 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8474 | /* Front Mic pin: input vref at 80% */ |
| 8475 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8476 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8477 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8478 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8479 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8480 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8481 | |
| 8482 | /* FIXME: use matrix-type input source selection */ |
| 8483 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8484 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8485 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8486 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8487 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8488 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8489 | /* Input mixer2 */ |
| 8490 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8491 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8492 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8493 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8494 | /* Input mixer3 */ |
| 8495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8497 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8498 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8499 | /* ADC1: mute amp left and right */ |
| 8500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8501 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8502 | /* ADC2: mute amp left and right */ |
| 8503 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8504 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8505 | /* ADC3: mute amp left and right */ |
| 8506 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8507 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8508 | |
| 8509 | { } |
| 8510 | }; |
| 8511 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8512 | /* iMac 9,1 */ |
| 8513 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8514 | /* Internal Speaker Pin (0x0c) */ |
| 8515 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8516 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8517 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8518 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8519 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8520 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8521 | /* HP Pin: Rear */ |
| 8522 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8523 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8524 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8525 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8526 | /* Line in Rear */ |
| 8527 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8528 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8529 | /* Front Mic pin: input vref at 80% */ |
| 8530 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8531 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8532 | /* Rear mixer */ |
| 8533 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8534 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8535 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8536 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8537 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8538 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8539 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8540 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8541 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8542 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8543 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8544 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8545 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8546 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8547 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8548 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8549 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8550 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8551 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8552 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8553 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8554 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8555 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8556 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8557 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8558 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8559 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8560 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8561 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8562 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8563 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8564 | { } |
| 8565 | }; |
| 8566 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8567 | /* iMac 24 mixer. */ |
| 8568 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8569 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8570 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8571 | { } /* end */ |
| 8572 | }; |
| 8573 | |
| 8574 | /* iMac 24 init verbs. */ |
| 8575 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8576 | /* Internal speakers: output 0 (0x0c) */ |
| 8577 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8578 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8579 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8580 | /* Internal speakers: output 0 (0x0c) */ |
| 8581 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8582 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8583 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8584 | /* Headphone: output 0 (0x0c) */ |
| 8585 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8586 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8587 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8588 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8589 | /* Front Mic: input vref at 80% */ |
| 8590 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8591 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8592 | { } |
| 8593 | }; |
| 8594 | |
| 8595 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8596 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8597 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8598 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8599 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8600 | spec->autocfg.hp_pins[0] = 0x14; |
| 8601 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8602 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8603 | } |
| 8604 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8605 | #define alc885_mb5_setup alc885_imac24_setup |
| 8606 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8607 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8608 | /* Macbook Air 2,1 */ |
| 8609 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8610 | { |
| 8611 | struct alc_spec *spec = codec->spec; |
| 8612 | |
| 8613 | spec->autocfg.hp_pins[0] = 0x14; |
| 8614 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8615 | } |
| 8616 | |
| 8617 | |
| 8618 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8619 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8620 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8621 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8622 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8623 | spec->autocfg.hp_pins[0] = 0x15; |
| 8624 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8625 | } |
| 8626 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8627 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8628 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8629 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8630 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8631 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8632 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8633 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8634 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8635 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8636 | static struct hda_verb alc882_targa_verbs[] = { |
| 8637 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8638 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8639 | |
| 8640 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8641 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8642 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8643 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8644 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8645 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8646 | |
| 8647 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8648 | { } /* end */ |
| 8649 | }; |
| 8650 | |
| 8651 | /* toggle speaker-output according to the hp-jack state */ |
| 8652 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8653 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8654 | struct alc_spec *spec = codec->spec; |
| 8655 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8656 | 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] | 8657 | spec->jack_present ? 1 : 3); |
| 8658 | } |
| 8659 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8660 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8661 | { |
| 8662 | struct alc_spec *spec = codec->spec; |
| 8663 | |
| 8664 | spec->autocfg.hp_pins[0] = 0x14; |
| 8665 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8666 | } |
| 8667 | |
| 8668 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8669 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8670 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8671 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8672 | } |
| 8673 | |
| 8674 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8675 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8676 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8677 | |
| 8678 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8679 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8680 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8681 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8682 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8683 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8684 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8685 | |
| 8686 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8687 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8688 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8689 | { } /* end */ |
| 8690 | }; |
| 8691 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8692 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8693 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8694 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8695 | |
| 8696 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8697 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8698 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8699 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8700 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8701 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8702 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8703 | |
| 8704 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8705 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8706 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8707 | { } /* end */ |
| 8708 | }; |
| 8709 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8710 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8711 | { |
| 8712 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8713 | |
| 8714 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8715 | AC_VERB_GET_GPIO_DATA, 0); |
| 8716 | |
| 8717 | if (!muted) |
| 8718 | gpiostate |= (1 << pin); |
| 8719 | else |
| 8720 | gpiostate &= ~(1 << pin); |
| 8721 | |
| 8722 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8723 | AC_VERB_GET_GPIO_MASK, 0); |
| 8724 | gpiomask |= (1 << pin); |
| 8725 | |
| 8726 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8727 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8728 | gpiodir |= (1 << pin); |
| 8729 | |
| 8730 | |
| 8731 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8732 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8733 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8734 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8735 | |
| 8736 | msleep(1); |
| 8737 | |
| 8738 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8739 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8740 | } |
| 8741 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8742 | /* set up GPIO at initialization */ |
| 8743 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8744 | { |
| 8745 | alc882_gpio_mute(codec, 0, 0); |
| 8746 | alc882_gpio_mute(codec, 1, 0); |
| 8747 | } |
| 8748 | |
| 8749 | /* set up GPIO and update auto-muting at initialization */ |
| 8750 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8751 | { |
| 8752 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8753 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8754 | } |
| 8755 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8756 | /* |
| 8757 | * generic initialization of ADC, input mixers and output mixers |
| 8758 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8759 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8760 | /* |
| 8761 | * Unmute ADC0-2 and set the default input to mic-in |
| 8762 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8763 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8764 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8765 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8766 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8767 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8768 | /* |
| 8769 | * Set up output mixers (0x0c - 0x0f) |
| 8770 | */ |
| 8771 | /* set vol=0 to output mixers */ |
| 8772 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8773 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8774 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8775 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8776 | /* set up input amps for analog loopback */ |
| 8777 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8778 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8779 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8780 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8781 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8782 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8783 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8784 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8785 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8786 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8787 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8788 | |
| 8789 | /* FIXME: use matrix-type input source selection */ |
| 8790 | /* 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] | 8791 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8792 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8793 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8794 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8795 | { } |
| 8796 | }; |
| 8797 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8798 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8799 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8800 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8801 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8802 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8803 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8804 | { } /* end */ |
| 8805 | }; |
| 8806 | |
| 8807 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8808 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8809 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8810 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8811 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8812 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8813 | { } /* end */ |
| 8814 | }; |
| 8815 | |
| 8816 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8817 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8818 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8819 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8820 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8821 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8822 | { } /* end */ |
| 8823 | }; |
| 8824 | |
| 8825 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8826 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8827 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8828 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8829 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8830 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8831 | { } /* end */ |
| 8832 | }; |
| 8833 | |
| 8834 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8835 | { 2, alc889A_mb31_ch2_init }, |
| 8836 | { 4, alc889A_mb31_ch4_init }, |
| 8837 | { 5, alc889A_mb31_ch5_init }, |
| 8838 | { 6, alc889A_mb31_ch6_init }, |
| 8839 | }; |
| 8840 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8841 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8842 | /* eanable EAPD on medion laptop */ |
| 8843 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8844 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8845 | { } |
| 8846 | }; |
| 8847 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8848 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8849 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8850 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8851 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8852 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8853 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8854 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8855 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8856 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8857 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8858 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8859 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8860 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8861 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8862 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8863 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8864 | { } /* end */ |
| 8865 | }; |
| 8866 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8867 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8868 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8869 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8870 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8871 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8872 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8873 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8875 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8876 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8877 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8878 | { } /* end */ |
| 8879 | }; |
| 8880 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8881 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8882 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8883 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8884 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8885 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 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), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8888 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8889 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8890 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8891 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8892 | { } /* end */ |
| 8893 | }; |
| 8894 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8895 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8896 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8897 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8898 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8899 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8900 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8901 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8902 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8903 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8904 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8905 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8906 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8907 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8908 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8909 | { } /* end */ |
| 8910 | }; |
| 8911 | |
| 8912 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8913 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8914 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8915 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8916 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8917 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8918 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8919 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8920 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8921 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8922 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8923 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8924 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8925 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8926 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8927 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8928 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8929 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8930 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8931 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8932 | { } /* end */ |
| 8933 | }; |
| 8934 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8935 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8936 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8937 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8938 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8939 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8940 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8941 | HDA_OUTPUT), |
| 8942 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8943 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8944 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8945 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8946 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8947 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8948 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8949 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8950 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8951 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8952 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8953 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8954 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8955 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8956 | { } /* end */ |
| 8957 | }; |
| 8958 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8959 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8960 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8961 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8962 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8963 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8964 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8965 | HDA_OUTPUT), |
| 8966 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8967 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8968 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8969 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8970 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8971 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8972 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8973 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8974 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8975 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8976 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8977 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8978 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8979 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8980 | { } /* end */ |
| 8981 | }; |
| 8982 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8983 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8984 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8985 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8986 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8987 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8988 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8989 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8990 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8991 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8992 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8993 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8994 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8995 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8996 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8998 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8999 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9000 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9001 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9002 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9003 | { } /* end */ |
| 9004 | }; |
| 9005 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9006 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9007 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9008 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9010 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9011 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9012 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9013 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9014 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9015 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9016 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9017 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9018 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9019 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9020 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9021 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9022 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9023 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9024 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9025 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9026 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9027 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9028 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9029 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9030 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9031 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9032 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9033 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9034 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9035 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9036 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9037 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9038 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9039 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9040 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9041 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9042 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9043 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 9044 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9045 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9046 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9047 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9048 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9049 | { } /* end */ |
| 9050 | }; |
| 9051 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9052 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9053 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9054 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9055 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9056 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9057 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9058 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9059 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9060 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9061 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9062 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9063 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9064 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9065 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9066 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9067 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9068 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9069 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9070 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9071 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9072 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9073 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9074 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9075 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9076 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9077 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9078 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9079 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9080 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9081 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9082 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9083 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9084 | { } /* end */ |
| 9085 | }; |
| 9086 | |
| 9087 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9088 | /* Unmute front mixer */ |
| 9089 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9090 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9091 | |
| 9092 | /* Set speaker pin to front mixer */ |
| 9093 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9094 | |
| 9095 | /* Init headphone pin */ |
| 9096 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9097 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9098 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9099 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9100 | |
| 9101 | { } /* end */ |
| 9102 | }; |
| 9103 | |
| 9104 | /* toggle speaker-output according to the hp-jack state */ |
| 9105 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9106 | { |
| 9107 | struct alc_spec *spec = codec->spec; |
| 9108 | |
| 9109 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9110 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9111 | } |
| 9112 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9113 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9114 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9115 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9116 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9117 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9118 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9119 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9120 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9121 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9122 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9123 | }; |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9124 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9125 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9126 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9127 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9128 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9129 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9130 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9131 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9132 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9133 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9134 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9135 | { } /* end */ |
| 9136 | }; |
| 9137 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9138 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9139 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9140 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9141 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9142 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9143 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9144 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9145 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9146 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9147 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9148 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9149 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9150 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9151 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9152 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9153 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9154 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9155 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9156 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9157 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9158 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9159 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9160 | { } /* end */ |
| 9161 | }; |
| 9162 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9163 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9164 | /* Output mixers */ |
| 9165 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9166 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9167 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9168 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9169 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9170 | HDA_OUTPUT), |
| 9171 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9172 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9173 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9174 | /* Output switches */ |
| 9175 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9176 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9177 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9178 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9179 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9180 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9181 | /* Input mixers */ |
| 9182 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9183 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9184 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9185 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9186 | { } /* end */ |
| 9187 | }; |
| 9188 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9189 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9190 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9191 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9192 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9193 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9194 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9195 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9196 | { } /* end */ |
| 9197 | }; |
| 9198 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9199 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9200 | .ops = &snd_hda_bind_vol, |
| 9201 | .values = { |
| 9202 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9203 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9204 | 0 |
| 9205 | }, |
| 9206 | }; |
| 9207 | |
| 9208 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9209 | .ops = &snd_hda_bind_sw, |
| 9210 | .values = { |
| 9211 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9212 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9213 | 0 |
| 9214 | }, |
| 9215 | }; |
| 9216 | |
| 9217 | static struct snd_kcontrol_new alc883_asus_eee1601_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", 0x14, 0x0, HDA_OUTPUT), |
| 9221 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9222 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9224 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9225 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9226 | { } /* end */ |
| 9227 | }; |
| 9228 | |
| 9229 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9230 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9231 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9232 | { |
| 9233 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9234 | /* .name = "Capture Source", */ |
| 9235 | .name = "Input Source", |
| 9236 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9237 | .info = alc_mux_enum_info, |
| 9238 | .get = alc_mux_enum_get, |
| 9239 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9240 | }, |
| 9241 | { } /* end */ |
| 9242 | }; |
| 9243 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9244 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9245 | { |
| 9246 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9247 | .name = "Channel Mode", |
| 9248 | .info = alc_ch_mode_info, |
| 9249 | .get = alc_ch_mode_get, |
| 9250 | .put = alc_ch_mode_put, |
| 9251 | }, |
| 9252 | { } /* end */ |
| 9253 | }; |
| 9254 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9255 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9256 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9257 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9258 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9259 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9260 | spec->autocfg.hp_pins[0] = 0x15; |
| 9261 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9262 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9263 | } |
| 9264 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9265 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9266 | /* HP */ |
| 9267 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9268 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9269 | /* Subwoofer */ |
| 9270 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9271 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9272 | |
| 9273 | /* enable unsolicited event */ |
| 9274 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9275 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9276 | |
| 9277 | { } /* end */ |
| 9278 | }; |
| 9279 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9280 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9281 | /* HP */ |
| 9282 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9283 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9284 | /* Int speaker */ |
| 9285 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9286 | |
| 9287 | /* enable unsolicited event */ |
| 9288 | /* |
| 9289 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9290 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9291 | */ |
| 9292 | |
| 9293 | { } /* end */ |
| 9294 | }; |
| 9295 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9296 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9297 | /* HP */ |
| 9298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9299 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9300 | /* Int speaker */ |
| 9301 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9302 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9303 | |
| 9304 | /* enable unsolicited event */ |
| 9305 | {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] | 9306 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9307 | |
| 9308 | { } /* end */ |
| 9309 | }; |
| 9310 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9311 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9312 | /* HP */ |
| 9313 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9314 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9315 | /* Subwoofer */ |
| 9316 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9317 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9318 | |
| 9319 | /* enable unsolicited event */ |
| 9320 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9321 | |
| 9322 | { } /* end */ |
| 9323 | }; |
| 9324 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9325 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9326 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9327 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9328 | |
| 9329 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9330 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9331 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9332 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9333 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9334 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9335 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9336 | /* Connect Mic jack to CLFE */ |
| 9337 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9338 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9339 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9340 | /* Connect Line-in jack to Surround */ |
| 9341 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9342 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9343 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9344 | /* Connect HP out jack to Front */ |
| 9345 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9346 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9347 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9348 | |
| 9349 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9350 | |
| 9351 | { } /* end */ |
| 9352 | }; |
| 9353 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9354 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9355 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9356 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9357 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9358 | { } /* end */ |
| 9359 | }; |
| 9360 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9361 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9362 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9364 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9365 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9366 | { } /* end */ |
| 9367 | }; |
| 9368 | |
| 9369 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9371 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9372 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9373 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9374 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9375 | { } /* end */ |
| 9376 | }; |
| 9377 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9378 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9379 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9381 | |
| 9382 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9383 | |
| 9384 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9385 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9386 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9387 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9388 | { } /* end */ |
| 9389 | }; |
| 9390 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9391 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9392 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9393 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9394 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9395 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9396 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9397 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9398 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9399 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9400 | { } /* end */ |
| 9401 | }; |
| 9402 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9403 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9404 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9405 | { } |
| 9406 | }; |
| 9407 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9408 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9409 | /* HP */ |
| 9410 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9411 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9412 | |
| 9413 | /* enable unsolicited event */ |
| 9414 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9415 | |
| 9416 | { } /* end */ |
| 9417 | }; |
| 9418 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9419 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9420 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9421 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9422 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9423 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9424 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9425 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9426 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9427 | } |
| 9428 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9429 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9430 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9431 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9432 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9433 | {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] | 9434 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9435 | }; |
| 9436 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9437 | /* |
| 9438 | * 2ch mode |
| 9439 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9440 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9441 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9442 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9443 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9444 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9445 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9446 | }; |
| 9447 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9448 | /* |
| 9449 | * 4ch mode |
| 9450 | */ |
| 9451 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9452 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9453 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9454 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9455 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9456 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9457 | { } /* end */ |
| 9458 | }; |
| 9459 | |
| 9460 | /* |
| 9461 | * 6ch mode |
| 9462 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9463 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9464 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9465 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9466 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9467 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9468 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9469 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9470 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9471 | }; |
| 9472 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9473 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9474 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9475 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9476 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9477 | }; |
| 9478 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9479 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9480 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9481 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9482 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9483 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9484 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9485 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9486 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9487 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9488 | } |
| 9489 | |
| 9490 | /* toggle RCA according to the front-jack state */ |
| 9491 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9492 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9493 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9494 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9495 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9496 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9497 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9498 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9499 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9500 | unsigned int res) |
| 9501 | { |
| 9502 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9503 | alc888_lenovo_ms7195_front_automute(codec); |
| 9504 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9505 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9506 | } |
| 9507 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9508 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9509 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9510 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9511 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9512 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9513 | spec->autocfg.hp_pins[0] = 0x14; |
| 9514 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9515 | } |
| 9516 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9517 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9518 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9519 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9520 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9521 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9522 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9523 | struct alc_spec *spec = codec->spec; |
| 9524 | |
| 9525 | spec->autocfg.hp_pins[0] = 0x15; |
| 9526 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9527 | } |
| 9528 | |
| 9529 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9530 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9531 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9532 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9533 | } |
| 9534 | |
| 9535 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9536 | unsigned int res) |
| 9537 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9538 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9539 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9540 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9541 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9542 | default: |
| 9543 | alc_automute_amp_unsol_event(codec, res); |
| 9544 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9545 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9546 | } |
| 9547 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9548 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9549 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9550 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9551 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9552 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9553 | spec->autocfg.hp_pins[0] = 0x14; |
| 9554 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9555 | } |
| 9556 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9557 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9558 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9559 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9560 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9561 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9562 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9563 | } |
| 9564 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9565 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9566 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9567 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9568 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9569 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9570 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9571 | } |
| 9572 | |
| 9573 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9574 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9575 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9576 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9577 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9578 | HDA_AMP_MUTE, bits); |
| 9579 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9580 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9581 | } |
| 9582 | |
| 9583 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9584 | unsigned int res) |
| 9585 | { |
| 9586 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9587 | alc883_lenovo_101e_all_automute(codec); |
| 9588 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9589 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9590 | } |
| 9591 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9592 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9593 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9594 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9595 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9596 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9597 | spec->autocfg.hp_pins[0] = 0x14; |
| 9598 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9599 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9600 | } |
| 9601 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9602 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9603 | /* HP Pin: output 0 (0x0c) */ |
| 9604 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9605 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9606 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9607 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9608 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9609 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9610 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9611 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9612 | /* eanable EAPD on medion laptop */ |
| 9613 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9614 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9615 | /* enable unsolicited event */ |
| 9616 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9617 | { } |
| 9618 | }; |
| 9619 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9620 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9621 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9622 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9623 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9624 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9625 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9626 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9627 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9628 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9629 | } |
| 9630 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9631 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9632 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9633 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9634 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9635 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9636 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9637 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9638 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9639 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9640 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9641 | } |
| 9642 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9643 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9644 | { |
| 9645 | struct alc_spec *spec = codec->spec; |
| 9646 | |
| 9647 | spec->autocfg.hp_pins[0] = 0x15; |
| 9648 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9649 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9650 | } |
| 9651 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9652 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9653 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9654 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9655 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9656 | /* enable unsolicited event */ |
| 9657 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9658 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9659 | { } /* end */ |
| 9660 | }; |
| 9661 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9662 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9663 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9664 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9665 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9666 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9667 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9668 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9669 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9670 | spec->ext_mic.pin = 0x18; |
| 9671 | spec->int_mic.pin = 0x19; |
| 9672 | spec->ext_mic.mux_idx = 0; |
| 9673 | spec->int_mic.mux_idx = 1; |
| 9674 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9675 | } |
| 9676 | |
| 9677 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9678 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9679 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9680 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9681 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9682 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9683 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9684 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9685 | /* enable unsolicited event */ |
| 9686 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9687 | { } /* end */ |
| 9688 | }; |
| 9689 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9690 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9691 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9692 | struct alc_spec *spec = codec->spec; |
| 9693 | |
| 9694 | spec->autocfg.hp_pins[0] = 0x14; |
| 9695 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9696 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9697 | } |
| 9698 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9699 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9700 | /* Init rear pin (used as headphone output) */ |
| 9701 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9702 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9703 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9704 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9705 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9706 | /* Init line 2 pin (used as headphone out by default) */ |
| 9707 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9708 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9709 | { } /* end */ |
| 9710 | }; |
| 9711 | |
| 9712 | /* Mute speakers according to the headphone jack state */ |
| 9713 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9714 | { |
| 9715 | unsigned int present; |
| 9716 | |
| 9717 | /* Mute only in 2ch or 4ch mode */ |
| 9718 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9719 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9720 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9721 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9722 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9723 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9724 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9725 | } |
| 9726 | } |
| 9727 | |
| 9728 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9729 | { |
| 9730 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9731 | alc889A_mb31_automute(codec); |
| 9732 | } |
| 9733 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9734 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9735 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9736 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9737 | #endif |
| 9738 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9739 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9740 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9741 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9742 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9743 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9744 | |
| 9745 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9746 | ALC1200_DIGOUT_NID, 0, |
| 9747 | }; |
| 9748 | |
| 9749 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9750 | ALC883_DIGOUT_NID, 0, |
| 9751 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9752 | |
| 9753 | /* |
| 9754 | * configuration and preset |
| 9755 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 9756 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9757 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9758 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9759 | [ALC882_ARIMA] = "arima", |
| 9760 | [ALC882_W2JC] = "w2jc", |
| 9761 | [ALC882_TARGA] = "targa", |
| 9762 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9763 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9764 | [ALC885_MACPRO] = "macpro", |
| 9765 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9766 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9767 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9768 | [ALC885_MBP3] = "mbp3", |
| 9769 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9770 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9771 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9772 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9773 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9774 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9775 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9776 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9777 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9778 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9779 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9780 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9781 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9782 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9783 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9784 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9785 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9786 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9787 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9788 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9789 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9790 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9791 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9792 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9793 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9794 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9795 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9796 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9797 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9798 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9799 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9800 | [ALC889A_INTEL] = "intel-alc889a", |
| 9801 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9802 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9803 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9804 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9805 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9806 | }; |
| 9807 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9808 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9809 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9810 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9811 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9812 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9813 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9814 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9815 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9816 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9817 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9818 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9819 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9820 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9821 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9822 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9823 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9824 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9825 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9826 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9827 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9828 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9829 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9830 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9831 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9832 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9833 | /* default Acer -- disabled as it causes more problems. |
| 9834 | * model=auto should work fine now |
| 9835 | */ |
| 9836 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9837 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9838 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9839 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 9840 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9841 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9842 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9843 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9844 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9845 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9846 | |
| 9847 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9848 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9849 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9850 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9851 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9852 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9853 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9854 | 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] | 9855 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9856 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9857 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9858 | |
| 9859 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9860 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9861 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9862 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9863 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9864 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9865 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9866 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9867 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9868 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9869 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9870 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9871 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9872 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9873 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9874 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9875 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9876 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9877 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9878 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9879 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9880 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9881 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9882 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9883 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9884 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9885 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9886 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9887 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9888 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9889 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9890 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9891 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9892 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9893 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9894 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9895 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9896 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9897 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9898 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9899 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9900 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9901 | 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] | 9902 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9903 | 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] | 9904 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9905 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9906 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9907 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9908 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9909 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9910 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9911 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9912 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9913 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9914 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9915 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9916 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9917 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9918 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9919 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9920 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9921 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9922 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9923 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9924 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9925 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9926 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9927 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9928 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9929 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9930 | {} |
| 9931 | }; |
| 9932 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9933 | /* codec SSID table for Intel Mac */ |
| 9934 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9935 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9936 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9937 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9938 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9939 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9940 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9941 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9942 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9943 | 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] | 9944 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9945 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9946 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9947 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9948 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9949 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9950 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9951 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9952 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9953 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9954 | */ |
| 9955 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9956 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9957 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9958 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9959 | }; |
| 9960 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9961 | static struct alc_config_preset alc882_presets[] = { |
| 9962 | [ALC882_3ST_DIG] = { |
| 9963 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9964 | .init_verbs = { alc882_base_init_verbs, |
| 9965 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9966 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9967 | .dac_nids = alc882_dac_nids, |
| 9968 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9969 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9970 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9971 | .channel_mode = alc882_ch_modes, |
| 9972 | .need_dac_fix = 1, |
| 9973 | .input_mux = &alc882_capture_source, |
| 9974 | }, |
| 9975 | [ALC882_6ST_DIG] = { |
| 9976 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9977 | .init_verbs = { alc882_base_init_verbs, |
| 9978 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9979 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9980 | .dac_nids = alc882_dac_nids, |
| 9981 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9982 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9983 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9984 | .channel_mode = alc882_sixstack_modes, |
| 9985 | .input_mux = &alc882_capture_source, |
| 9986 | }, |
| 9987 | [ALC882_ARIMA] = { |
| 9988 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9989 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9990 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9991 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9992 | .dac_nids = alc882_dac_nids, |
| 9993 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9994 | .channel_mode = alc882_sixstack_modes, |
| 9995 | .input_mux = &alc882_capture_source, |
| 9996 | }, |
| 9997 | [ALC882_W2JC] = { |
| 9998 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9999 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10000 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10001 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10002 | .dac_nids = alc882_dac_nids, |
| 10003 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10004 | .channel_mode = alc880_threestack_modes, |
| 10005 | .need_dac_fix = 1, |
| 10006 | .input_mux = &alc882_capture_source, |
| 10007 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10008 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10009 | [ALC885_MBA21] = { |
| 10010 | .mixers = { alc885_mba21_mixer }, |
| 10011 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10012 | .num_dacs = 2, |
| 10013 | .dac_nids = alc882_dac_nids, |
| 10014 | .channel_mode = alc885_mba21_ch_modes, |
| 10015 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10016 | .input_mux = &alc882_capture_source, |
| 10017 | .unsol_event = alc_automute_amp_unsol_event, |
| 10018 | .setup = alc885_mba21_setup, |
| 10019 | .init_hook = alc_automute_amp, |
| 10020 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10021 | [ALC885_MBP3] = { |
| 10022 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10023 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10024 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10025 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10026 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10027 | .hp_nid = 0x04, |
| 10028 | .channel_mode = alc885_mbp_4ch_modes, |
| 10029 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10030 | .input_mux = &alc882_capture_source, |
| 10031 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10032 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10033 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10034 | .setup = alc885_mbp3_setup, |
| 10035 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10036 | }, |
| 10037 | [ALC885_MB5] = { |
| 10038 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10039 | .init_verbs = { alc885_mb5_init_verbs, |
| 10040 | alc880_gpio1_init_verbs }, |
| 10041 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10042 | .dac_nids = alc882_dac_nids, |
| 10043 | .channel_mode = alc885_mb5_6ch_modes, |
| 10044 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10045 | .input_mux = &mb5_capture_source, |
| 10046 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10047 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10048 | .unsol_event = alc_automute_amp_unsol_event, |
| 10049 | .setup = alc885_mb5_setup, |
| 10050 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10051 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10052 | [ALC885_MACMINI3] = { |
| 10053 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10054 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10055 | alc880_gpio1_init_verbs }, |
| 10056 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10057 | .dac_nids = alc882_dac_nids, |
| 10058 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10059 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10060 | .input_mux = &macmini3_capture_source, |
| 10061 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10062 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10063 | .unsol_event = alc_automute_amp_unsol_event, |
| 10064 | .setup = alc885_macmini3_setup, |
| 10065 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10066 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10067 | [ALC885_MACPRO] = { |
| 10068 | .mixers = { alc882_macpro_mixer }, |
| 10069 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10070 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10071 | .dac_nids = alc882_dac_nids, |
| 10072 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10073 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10074 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10075 | .channel_mode = alc882_ch_modes, |
| 10076 | .input_mux = &alc882_capture_source, |
| 10077 | .init_hook = alc885_macpro_init_hook, |
| 10078 | }, |
| 10079 | [ALC885_IMAC24] = { |
| 10080 | .mixers = { alc885_imac24_mixer }, |
| 10081 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10082 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10083 | .dac_nids = alc882_dac_nids, |
| 10084 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10085 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10086 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10087 | .channel_mode = alc882_ch_modes, |
| 10088 | .input_mux = &alc882_capture_source, |
| 10089 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10090 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10091 | .init_hook = alc885_imac24_init_hook, |
| 10092 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10093 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10094 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10095 | .init_verbs = { alc885_imac91_init_verbs, |
| 10096 | alc880_gpio1_init_verbs }, |
| 10097 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10098 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10099 | .channel_mode = alc885_mba21_ch_modes, |
| 10100 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10101 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10102 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10103 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10104 | .unsol_event = alc_automute_amp_unsol_event, |
| 10105 | .setup = alc885_imac91_setup, |
| 10106 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10107 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10108 | [ALC882_TARGA] = { |
| 10109 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10110 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10111 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10112 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10113 | .dac_nids = alc882_dac_nids, |
| 10114 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10115 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10116 | .adc_nids = alc882_adc_nids, |
| 10117 | .capsrc_nids = alc882_capsrc_nids, |
| 10118 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10119 | .channel_mode = alc882_3ST_6ch_modes, |
| 10120 | .need_dac_fix = 1, |
| 10121 | .input_mux = &alc882_capture_source, |
| 10122 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10123 | .setup = alc882_targa_setup, |
| 10124 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10125 | }, |
| 10126 | [ALC882_ASUS_A7J] = { |
| 10127 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10128 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10129 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10130 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10131 | .dac_nids = alc882_dac_nids, |
| 10132 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10133 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10134 | .adc_nids = alc882_adc_nids, |
| 10135 | .capsrc_nids = alc882_capsrc_nids, |
| 10136 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10137 | .channel_mode = alc882_3ST_6ch_modes, |
| 10138 | .need_dac_fix = 1, |
| 10139 | .input_mux = &alc882_capture_source, |
| 10140 | }, |
| 10141 | [ALC882_ASUS_A7M] = { |
| 10142 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10143 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10144 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10145 | alc882_asus_a7m_verbs }, |
| 10146 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10147 | .dac_nids = alc882_dac_nids, |
| 10148 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10149 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10150 | .channel_mode = alc880_threestack_modes, |
| 10151 | .need_dac_fix = 1, |
| 10152 | .input_mux = &alc882_capture_source, |
| 10153 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10154 | [ALC883_3ST_2ch_DIG] = { |
| 10155 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10156 | .init_verbs = { alc883_init_verbs }, |
| 10157 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10158 | .dac_nids = alc883_dac_nids, |
| 10159 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10160 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10161 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10162 | .channel_mode = alc883_3ST_2ch_modes, |
| 10163 | .input_mux = &alc883_capture_source, |
| 10164 | }, |
| 10165 | [ALC883_3ST_6ch_DIG] = { |
| 10166 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10167 | .init_verbs = { alc883_init_verbs }, |
| 10168 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10169 | .dac_nids = alc883_dac_nids, |
| 10170 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10171 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10172 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10173 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10174 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10175 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10176 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10177 | [ALC883_3ST_6ch] = { |
| 10178 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10179 | .init_verbs = { alc883_init_verbs }, |
| 10180 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10181 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10182 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10183 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10184 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10185 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10186 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10187 | [ALC883_3ST_6ch_INTEL] = { |
| 10188 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10189 | .init_verbs = { alc883_init_verbs }, |
| 10190 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10191 | .dac_nids = alc883_dac_nids, |
| 10192 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10193 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10194 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10195 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10196 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10197 | .need_dac_fix = 1, |
| 10198 | .input_mux = &alc883_3stack_6ch_intel, |
| 10199 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10200 | [ALC889A_INTEL] = { |
| 10201 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10202 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10203 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10204 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10205 | .dac_nids = alc883_dac_nids, |
| 10206 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10207 | .adc_nids = alc889_adc_nids, |
| 10208 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10209 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10210 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10211 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10212 | .channel_mode = alc889_8ch_intel_modes, |
| 10213 | .capsrc_nids = alc889_capsrc_nids, |
| 10214 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10215 | .setup = alc889_automute_setup, |
| 10216 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10217 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10218 | .need_dac_fix = 1, |
| 10219 | }, |
| 10220 | [ALC889_INTEL] = { |
| 10221 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10222 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10223 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10224 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10225 | .dac_nids = alc883_dac_nids, |
| 10226 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10227 | .adc_nids = alc889_adc_nids, |
| 10228 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10229 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10230 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10231 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10232 | .channel_mode = alc889_8ch_intel_modes, |
| 10233 | .capsrc_nids = alc889_capsrc_nids, |
| 10234 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10235 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10236 | .init_hook = alc889_intel_init_hook, |
| 10237 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10238 | .need_dac_fix = 1, |
| 10239 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10240 | [ALC883_6ST_DIG] = { |
| 10241 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10242 | .init_verbs = { alc883_init_verbs }, |
| 10243 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10244 | .dac_nids = alc883_dac_nids, |
| 10245 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10246 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10247 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10248 | .channel_mode = alc883_sixstack_modes, |
| 10249 | .input_mux = &alc883_capture_source, |
| 10250 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10251 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10252 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10253 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10254 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10256 | .dac_nids = alc883_dac_nids, |
| 10257 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10258 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10259 | .channel_mode = alc883_3ST_6ch_modes, |
| 10260 | .need_dac_fix = 1, |
| 10261 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10262 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10263 | .setup = alc882_targa_setup, |
| 10264 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10265 | }, |
| 10266 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10267 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10268 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10269 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10270 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10271 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10272 | .adc_nids = alc883_adc_nids_alt, |
| 10273 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10274 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10275 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10276 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10277 | .channel_mode = alc883_3ST_2ch_modes, |
| 10278 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10279 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10280 | .setup = alc882_targa_setup, |
| 10281 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10282 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10283 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10284 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10285 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10286 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10287 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10288 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10289 | .dac_nids = alc883_dac_nids, |
| 10290 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10291 | .adc_nids = alc883_adc_nids_rev, |
| 10292 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10293 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10294 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10295 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10296 | .channel_mode = alc883_4ST_8ch_modes, |
| 10297 | .need_dac_fix = 1, |
| 10298 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10299 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10300 | .setup = alc882_targa_setup, |
| 10301 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10302 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10303 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10304 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10305 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10306 | * and the headphone jack. Turn this on and rely on the |
| 10307 | * standard mute methods whenever the user wants to turn |
| 10308 | * these outputs off. |
| 10309 | */ |
| 10310 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10311 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10312 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10313 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10314 | .channel_mode = alc883_3ST_2ch_modes, |
| 10315 | .input_mux = &alc883_capture_source, |
| 10316 | }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10317 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10318 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10319 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10320 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10321 | .dac_nids = alc883_dac_nids, |
| 10322 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10323 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10324 | .channel_mode = alc883_3ST_2ch_modes, |
| 10325 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10326 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10327 | .setup = alc883_acer_aspire_setup, |
| 10328 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10329 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10330 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 10331 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10332 | alc883_chmode_mixer }, |
| 10333 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10334 | alc888_acer_aspire_4930g_verbs }, |
| 10335 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10336 | .dac_nids = alc883_dac_nids, |
| 10337 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10338 | .adc_nids = alc883_adc_nids_rev, |
| 10339 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10340 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10341 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10342 | .channel_mode = alc883_3ST_6ch_modes, |
| 10343 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10344 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10345 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10346 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10347 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10348 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10349 | .setup = alc888_acer_aspire_4930g_setup, |
| 10350 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10351 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10352 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10353 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10354 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10355 | alc888_acer_aspire_6530g_verbs }, |
| 10356 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10357 | .dac_nids = alc883_dac_nids, |
| 10358 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10359 | .adc_nids = alc883_adc_nids_rev, |
| 10360 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10361 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10362 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10363 | .channel_mode = alc883_3ST_2ch_modes, |
| 10364 | .num_mux_defs = |
| 10365 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10366 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10367 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10368 | .setup = alc888_acer_aspire_6530g_setup, |
| 10369 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10370 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10371 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10372 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10373 | alc883_chmode_mixer }, |
| 10374 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10375 | alc889_acer_aspire_8930g_verbs, |
| 10376 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10377 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10378 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10379 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10380 | .adc_nids = alc889_adc_nids, |
| 10381 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10382 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10383 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10384 | .channel_mode = alc883_3ST_6ch_modes, |
| 10385 | .need_dac_fix = 1, |
| 10386 | .const_channel_count = 6, |
| 10387 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10388 | ARRAY_SIZE(alc889_capture_sources), |
| 10389 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10390 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10391 | .setup = alc889_acer_aspire_8930g_setup, |
| 10392 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10393 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10394 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10395 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10396 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10397 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10398 | .mixers = { alc883_3ST_6ch_mixer, |
| 10399 | alc883_chmode_mixer }, |
| 10400 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10401 | alc888_acer_aspire_7730G_verbs }, |
| 10402 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10403 | .dac_nids = alc883_dac_nids, |
| 10404 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10405 | .adc_nids = alc883_adc_nids_rev, |
| 10406 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10407 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10408 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10409 | .channel_mode = alc883_3ST_6ch_modes, |
| 10410 | .need_dac_fix = 1, |
| 10411 | .const_channel_count = 6, |
| 10412 | .input_mux = &alc883_capture_source, |
| 10413 | .unsol_event = alc_automute_amp_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10414 | .setup = alc888_acer_aspire_7730g_setup, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10415 | .init_hook = alc_automute_amp, |
| 10416 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10417 | [ALC883_MEDION] = { |
| 10418 | .mixers = { alc883_fivestack_mixer, |
| 10419 | alc883_chmode_mixer }, |
| 10420 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10421 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10422 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10423 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10424 | .adc_nids = alc883_adc_nids_alt, |
| 10425 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10426 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10427 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10428 | .channel_mode = alc883_sixstack_modes, |
| 10429 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10430 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10431 | [ALC883_MEDION_WIM2160] = { |
| 10432 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10433 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10434 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10435 | .dac_nids = alc883_dac_nids, |
| 10436 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10437 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10438 | .adc_nids = alc883_adc_nids, |
| 10439 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10440 | .channel_mode = alc883_3ST_2ch_modes, |
| 10441 | .input_mux = &alc883_capture_source, |
| 10442 | .unsol_event = alc_automute_amp_unsol_event, |
| 10443 | .setup = alc883_medion_wim2160_setup, |
| 10444 | .init_hook = alc_automute_amp, |
| 10445 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10446 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10447 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10448 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10449 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10450 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10451 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10452 | .channel_mode = alc883_3ST_2ch_modes, |
| 10453 | .input_mux = &alc883_capture_source, |
| 10454 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10455 | [ALC883_CLEVO_M540R] = { |
| 10456 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10457 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10458 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10459 | .dac_nids = alc883_dac_nids, |
| 10460 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10461 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10462 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10463 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10464 | .need_dac_fix = 1, |
| 10465 | .input_mux = &alc883_capture_source, |
| 10466 | /* This machine has the hardware HP auto-muting, thus |
| 10467 | * we need no software mute via unsol event |
| 10468 | */ |
| 10469 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10470 | [ALC883_CLEVO_M720] = { |
| 10471 | .mixers = { alc883_clevo_m720_mixer }, |
| 10472 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10473 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10474 | .dac_nids = alc883_dac_nids, |
| 10475 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10476 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10477 | .channel_mode = alc883_3ST_2ch_modes, |
| 10478 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10479 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10480 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10481 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10482 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10483 | [ALC883_LENOVO_101E_2ch] = { |
| 10484 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10485 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10486 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10487 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10488 | .adc_nids = alc883_adc_nids_alt, |
| 10489 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10490 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10491 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10492 | .channel_mode = alc883_3ST_2ch_modes, |
| 10493 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10494 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10495 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10496 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10497 | [ALC883_LENOVO_NB0763] = { |
| 10498 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10499 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10500 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10501 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10502 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10503 | .channel_mode = alc883_3ST_2ch_modes, |
| 10504 | .need_dac_fix = 1, |
| 10505 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10506 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10507 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10508 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10509 | }, |
| 10510 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10511 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10512 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10513 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10514 | .dac_nids = alc883_dac_nids, |
| 10515 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10516 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10517 | .channel_mode = alc883_3ST_6ch_modes, |
| 10518 | .need_dac_fix = 1, |
| 10519 | .input_mux = &alc883_capture_source, |
| 10520 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10521 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10522 | }, |
| 10523 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10524 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10525 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10526 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10527 | .dac_nids = alc883_dac_nids, |
| 10528 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10529 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10530 | .channel_mode = alc883_3ST_2ch_modes, |
| 10531 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10532 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10533 | .setup = alc883_haier_w66_setup, |
| 10534 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10535 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10536 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10537 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10538 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10539 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10540 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10541 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10542 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10543 | .need_dac_fix = 1, |
| 10544 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10545 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10546 | .setup = alc888_3st_hp_setup, |
| 10547 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10548 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10549 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10550 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10551 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10552 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10553 | .dac_nids = alc883_dac_nids, |
| 10554 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10555 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10556 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10557 | .channel_mode = alc883_sixstack_modes, |
| 10558 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10559 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10560 | .setup = alc888_6st_dell_setup, |
| 10561 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10562 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10563 | [ALC883_MITAC] = { |
| 10564 | .mixers = { alc883_mitac_mixer }, |
| 10565 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10566 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10567 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10568 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10569 | .channel_mode = alc883_3ST_2ch_modes, |
| 10570 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10571 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10572 | .setup = alc883_mitac_setup, |
| 10573 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10574 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10575 | [ALC883_FUJITSU_PI2515] = { |
| 10576 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10577 | .init_verbs = { alc883_init_verbs, |
| 10578 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10579 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10580 | .dac_nids = alc883_dac_nids, |
| 10581 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10582 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10583 | .channel_mode = alc883_3ST_2ch_modes, |
| 10584 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10585 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10586 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10587 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10588 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10589 | [ALC888_FUJITSU_XA3530] = { |
| 10590 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10591 | .init_verbs = { alc883_init_verbs, |
| 10592 | alc888_fujitsu_xa3530_verbs }, |
| 10593 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10594 | .dac_nids = alc883_dac_nids, |
| 10595 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10596 | .adc_nids = alc883_adc_nids_rev, |
| 10597 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10598 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10599 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10600 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10601 | .num_mux_defs = |
| 10602 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10603 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10604 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10605 | .setup = alc888_fujitsu_xa3530_setup, |
| 10606 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10607 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10608 | [ALC888_LENOVO_SKY] = { |
| 10609 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10610 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10611 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10612 | .dac_nids = alc883_dac_nids, |
| 10613 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10614 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10615 | .channel_mode = alc883_sixstack_modes, |
| 10616 | .need_dac_fix = 1, |
| 10617 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10618 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10619 | .setup = alc888_lenovo_sky_setup, |
| 10620 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10621 | }, |
| 10622 | [ALC888_ASUS_M90V] = { |
| 10623 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10624 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10625 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10626 | .dac_nids = alc883_dac_nids, |
| 10627 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10628 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10629 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10630 | .channel_mode = alc883_3ST_6ch_modes, |
| 10631 | .need_dac_fix = 1, |
| 10632 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10633 | .unsol_event = alc_sku_unsol_event, |
| 10634 | .setup = alc883_mode2_setup, |
| 10635 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10636 | }, |
| 10637 | [ALC888_ASUS_EEE1601] = { |
| 10638 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10639 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10640 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10641 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10642 | .dac_nids = alc883_dac_nids, |
| 10643 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10644 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10645 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10646 | .channel_mode = alc883_3ST_2ch_modes, |
| 10647 | .need_dac_fix = 1, |
| 10648 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10649 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10650 | .init_hook = alc883_eee1601_inithook, |
| 10651 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10652 | [ALC1200_ASUS_P5Q] = { |
| 10653 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10654 | .init_verbs = { alc883_init_verbs }, |
| 10655 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10656 | .dac_nids = alc883_dac_nids, |
| 10657 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10658 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10659 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10660 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10661 | .channel_mode = alc883_sixstack_modes, |
| 10662 | .input_mux = &alc883_capture_source, |
| 10663 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10664 | [ALC889A_MB31] = { |
| 10665 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10666 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10667 | alc880_gpio1_init_verbs }, |
| 10668 | .adc_nids = alc883_adc_nids, |
| 10669 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10670 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10671 | .dac_nids = alc883_dac_nids, |
| 10672 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10673 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10674 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10675 | .input_mux = &alc889A_mb31_capture_source, |
| 10676 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10677 | .unsol_event = alc889A_mb31_unsol_event, |
| 10678 | .init_hook = alc889A_mb31_automute, |
| 10679 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10680 | [ALC883_SONY_VAIO_TT] = { |
| 10681 | .mixers = { alc883_vaiott_mixer }, |
| 10682 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10683 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10684 | .dac_nids = alc883_dac_nids, |
| 10685 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10686 | .channel_mode = alc883_3ST_2ch_modes, |
| 10687 | .input_mux = &alc883_capture_source, |
| 10688 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10689 | .setup = alc883_vaiott_setup, |
| 10690 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10691 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10692 | }; |
| 10693 | |
| 10694 | |
| 10695 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10696 | * Pin config fixes |
| 10697 | */ |
| 10698 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10699 | PINFIX_ABIT_AW9D_MAX, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10700 | PINFIX_LENOVO_Y530, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10701 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10702 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10703 | PINFIX_GIGABYTE_880GM, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10704 | }; |
| 10705 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10706 | static const struct alc_fixup alc882_fixups[] = { |
| 10707 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10708 | .type = ALC_FIXUP_PINS, |
| 10709 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10710 | { 0x15, 0x01080104 }, /* side */ |
| 10711 | { 0x16, 0x01011012 }, /* rear */ |
| 10712 | { 0x17, 0x01016011 }, /* clfe */ |
| 10713 | { } |
| 10714 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10715 | }, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10716 | [PINFIX_LENOVO_Y530] = { |
| 10717 | .type = ALC_FIXUP_PINS, |
| 10718 | .v.pins = (const struct alc_pincfg[]) { |
| 10719 | { 0x15, 0x99130112 }, /* rear int speakers */ |
| 10720 | { 0x16, 0x99130111 }, /* subwoofer */ |
| 10721 | { } |
| 10722 | } |
| 10723 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10724 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10725 | .type = ALC_FIXUP_VERBS, |
| 10726 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10727 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10728 | {} |
| 10729 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10730 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10731 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10732 | .type = ALC_FIXUP_SKU, |
| 10733 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10734 | }, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10735 | [PINFIX_GIGABYTE_880GM] = { |
| 10736 | .type = ALC_FIXUP_PINS, |
| 10737 | .v.pins = (const struct alc_pincfg[]) { |
| 10738 | { 0x14, 0x1114410 }, /* set as speaker */ |
| 10739 | { } |
| 10740 | } |
| 10741 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10742 | }; |
| 10743 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10744 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10745 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10746 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10747 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10748 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10749 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", PINFIX_GIGABYTE_880GM), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10750 | {} |
| 10751 | }; |
| 10752 | |
| 10753 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10754 | * BIOS auto configuration |
| 10755 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10756 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10757 | const struct auto_pin_cfg *cfg) |
| 10758 | { |
| 10759 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10760 | } |
| 10761 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10762 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10763 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10764 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10765 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10766 | int idx; |
| 10767 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10768 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10769 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10770 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10771 | if (dac == 0x25) |
| 10772 | idx = 4; |
| 10773 | else if (dac >= 0x02 && dac <= 0x05) |
| 10774 | idx = dac - 2; |
| 10775 | else |
| 10776 | return; |
| 10777 | 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] | 10778 | } |
| 10779 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10780 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10781 | { |
| 10782 | struct alc_spec *spec = codec->spec; |
| 10783 | int i; |
| 10784 | |
| 10785 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10786 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10787 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10788 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10789 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10790 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10791 | } |
| 10792 | } |
| 10793 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10794 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10795 | { |
| 10796 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10797 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10798 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10799 | |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 10800 | if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) { |
| 10801 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10802 | pin = spec->autocfg.hp_pins[i]; |
| 10803 | if (!pin) |
| 10804 | break; |
| 10805 | dac = spec->multiout.hp_nid; |
| 10806 | if (!dac) |
| 10807 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10808 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10809 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10810 | } |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 10811 | |
| 10812 | if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 10813 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10814 | pin = spec->autocfg.speaker_pins[i]; |
| 10815 | if (!pin) |
| 10816 | break; |
| 10817 | dac = spec->multiout.extra_out_nid[0]; |
| 10818 | if (!dac) |
| 10819 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10820 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10821 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10822 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10823 | } |
| 10824 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10825 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10826 | { |
| 10827 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10828 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10829 | int i; |
| 10830 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10831 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10832 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10833 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10834 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10835 | snd_hda_codec_write(codec, nid, 0, |
| 10836 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10837 | AMP_OUT_MUTE); |
| 10838 | } |
| 10839 | } |
| 10840 | |
| 10841 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10842 | { |
| 10843 | struct alc_spec *spec = codec->spec; |
| 10844 | int c; |
| 10845 | |
| 10846 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10847 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10848 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10849 | unsigned int mux_idx; |
| 10850 | const struct hda_input_mux *imux; |
| 10851 | int conns, mute, idx, item; |
| 10852 | |
| 10853 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10854 | ARRAY_SIZE(conn_list)); |
| 10855 | if (conns < 0) |
| 10856 | continue; |
| 10857 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10858 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10859 | if (!imux->num_items && mux_idx > 0) |
| 10860 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10861 | for (idx = 0; idx < conns; idx++) { |
| 10862 | /* if the current connection is the selected one, |
| 10863 | * unmute it as default - otherwise mute it |
| 10864 | */ |
| 10865 | mute = AMP_IN_MUTE(idx); |
| 10866 | for (item = 0; item < imux->num_items; item++) { |
| 10867 | if (imux->items[item].index == idx) { |
| 10868 | if (spec->cur_mux[c] == item) |
| 10869 | mute = AMP_IN_UNMUTE(idx); |
| 10870 | break; |
| 10871 | } |
| 10872 | } |
| 10873 | /* check if we have a selector or mixer |
| 10874 | * we could check for the widget type instead, but |
| 10875 | * just check for Amp-In presence (in case of mixer |
| 10876 | * without amp-in there is something wrong, this |
| 10877 | * function shouldn't be used or capsrc nid is wrong) |
| 10878 | */ |
| 10879 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10880 | snd_hda_codec_write(codec, nid, 0, |
| 10881 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10882 | mute); |
| 10883 | else if (mute != AMP_IN_MUTE(idx)) |
| 10884 | snd_hda_codec_write(codec, nid, 0, |
| 10885 | AC_VERB_SET_CONNECT_SEL, |
| 10886 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10887 | } |
| 10888 | } |
| 10889 | } |
| 10890 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10891 | /* add mic boosts if needed */ |
| 10892 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10893 | { |
| 10894 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10895 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10896 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10897 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10898 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10899 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10900 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10901 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10902 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10903 | break; |
| 10904 | nid = cfg->inputs[i].pin; |
| 10905 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10906 | const char *label; |
| 10907 | char boost_label[32]; |
| 10908 | |
| 10909 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 10910 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10911 | type_idx++; |
| 10912 | else |
| 10913 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10914 | prev_label = label; |
| 10915 | |
| 10916 | snprintf(boost_label, sizeof(boost_label), |
| 10917 | "%s Boost Volume", label); |
| 10918 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10919 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10920 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10921 | if (err < 0) |
| 10922 | return err; |
| 10923 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10924 | } |
| 10925 | return 0; |
| 10926 | } |
| 10927 | |
| 10928 | /* almost identical with ALC880 parser... */ |
| 10929 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10930 | { |
| 10931 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10932 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10933 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10934 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10935 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10936 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10937 | if (err < 0) |
| 10938 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10939 | if (!spec->autocfg.line_outs) |
| 10940 | return 0; /* can't find valid BIOS pin config */ |
| 10941 | |
| 10942 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10943 | if (err < 0) |
| 10944 | return err; |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 10945 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10946 | if (err < 0) |
| 10947 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10948 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10949 | "Headphone"); |
| 10950 | if (err < 0) |
| 10951 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10952 | err = alc880_auto_create_extra_out(spec, |
| 10953 | spec->autocfg.speaker_pins[0], |
| 10954 | "Speaker"); |
| 10955 | if (err < 0) |
| 10956 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10957 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10958 | if (err < 0) |
| 10959 | return err; |
| 10960 | |
| 10961 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10962 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10963 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10964 | |
| 10965 | if (spec->kctls.list) |
| 10966 | add_mixer(spec, spec->kctls.list); |
| 10967 | |
| 10968 | add_verb(spec, alc883_auto_init_verbs); |
| 10969 | /* if ADC 0x07 is available, initialize it, too */ |
| 10970 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10971 | add_verb(spec, alc882_adc1_init_verbs); |
| 10972 | |
| 10973 | spec->num_mux_defs = 1; |
| 10974 | spec->input_mux = &spec->private_imux[0]; |
| 10975 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10976 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10977 | |
| 10978 | err = alc_auto_add_mic_boost(codec); |
| 10979 | if (err < 0) |
| 10980 | return err; |
| 10981 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10982 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10983 | } |
| 10984 | |
| 10985 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10986 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10987 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10988 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10989 | alc882_auto_init_multi_out(codec); |
| 10990 | alc882_auto_init_hp_out(codec); |
| 10991 | alc882_auto_init_analog_input(codec); |
| 10992 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10993 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10994 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10995 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10996 | } |
| 10997 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10998 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10999 | { |
| 11000 | struct alc_spec *spec; |
| 11001 | int err, board_config; |
| 11002 | |
| 11003 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11004 | if (spec == NULL) |
| 11005 | return -ENOMEM; |
| 11006 | |
| 11007 | codec->spec = spec; |
| 11008 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11009 | switch (codec->vendor_id) { |
| 11010 | case 0x10ec0882: |
| 11011 | case 0x10ec0885: |
| 11012 | break; |
| 11013 | default: |
| 11014 | /* ALC883 and variants */ |
| 11015 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11016 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11017 | } |
| 11018 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11019 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 11020 | alc882_models, |
| 11021 | alc882_cfg_tbl); |
| 11022 | |
| 11023 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11024 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11025 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11026 | |
| 11027 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11028 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11029 | codec->chip_name); |
| 11030 | board_config = ALC882_AUTO; |
| 11031 | } |
| 11032 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11033 | if (board_config == ALC882_AUTO) { |
| 11034 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11035 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11036 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11037 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11038 | alc_auto_parse_customize_define(codec); |
| 11039 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11040 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11041 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11042 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11043 | if (err < 0) { |
| 11044 | alc_free(codec); |
| 11045 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11046 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11047 | printk(KERN_INFO |
| 11048 | "hda_codec: Cannot set up configuration " |
| 11049 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11050 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11051 | } |
| 11052 | } |
| 11053 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11054 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11055 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11056 | if (err < 0) { |
| 11057 | alc_free(codec); |
| 11058 | return err; |
| 11059 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11060 | } |
| 11061 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11062 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11063 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11064 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11065 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11066 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11067 | /* FIXME: setup DAC5 */ |
| 11068 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11069 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11070 | |
| 11071 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11072 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11073 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11074 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11075 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11076 | spec->num_adc_nids = 0; |
| 11077 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11078 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11079 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11080 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11081 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11082 | unsigned int wcap = get_wcaps(codec, nid); |
| 11083 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11084 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11085 | if (wcap != AC_WID_AUD_IN) |
| 11086 | continue; |
| 11087 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11088 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11089 | if (err < 0) |
| 11090 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11091 | err = snd_hda_get_connections(codec, cap, items, |
| 11092 | ARRAY_SIZE(items)); |
| 11093 | if (err < 0) |
| 11094 | continue; |
| 11095 | for (j = 0; j < imux->num_items; j++) |
| 11096 | if (imux->items[j].index >= err) |
| 11097 | break; |
| 11098 | if (j < imux->num_items) |
| 11099 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11100 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11101 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11102 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11103 | spec->adc_nids = spec->private_adc_nids; |
| 11104 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11105 | } |
| 11106 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11107 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11108 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11109 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11110 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11111 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11112 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11113 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11114 | spec->vmaster_nid = 0x0c; |
| 11115 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11116 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11117 | if (board_config == ALC882_AUTO) |
| 11118 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11119 | |
| 11120 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11121 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11122 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11123 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11124 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11125 | |
| 11126 | return 0; |
| 11127 | } |
| 11128 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11129 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11130 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11131 | * ALC262 support |
| 11132 | */ |
| 11133 | |
| 11134 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11135 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11136 | |
| 11137 | #define alc262_dac_nids alc260_dac_nids |
| 11138 | #define alc262_adc_nids alc882_adc_nids |
| 11139 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11140 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11141 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11142 | |
| 11143 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11144 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11145 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11146 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11147 | /* ADC0 */ |
| 11148 | 0x09 |
| 11149 | }; |
| 11150 | |
| 11151 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11152 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11153 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11154 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11155 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11156 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11157 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11158 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11159 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11160 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11161 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11162 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11163 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11164 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11165 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11166 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11167 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11168 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11169 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11170 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11171 | }; |
| 11172 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11173 | /* update HP, line and mono-out pins according to the master switch */ |
| 11174 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 11175 | { |
| 11176 | struct alc_spec *spec = codec->spec; |
| 11177 | int val = spec->master_sw; |
| 11178 | |
| 11179 | /* HP & line-out */ |
| 11180 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 11181 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11182 | val ? PIN_HP : 0); |
| 11183 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11184 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11185 | val ? PIN_HP : 0); |
| 11186 | /* mono (speaker) depending on the HP jack sense */ |
| 11187 | val = val && !spec->jack_present; |
| 11188 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11189 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11190 | val ? PIN_OUT : 0); |
| 11191 | } |
| 11192 | |
| 11193 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11194 | { |
| 11195 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11196 | |
| 11197 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11198 | alc262_hp_master_update(codec); |
| 11199 | } |
| 11200 | |
| 11201 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11202 | { |
| 11203 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11204 | return; |
| 11205 | alc262_hp_bpc_automute(codec); |
| 11206 | } |
| 11207 | |
| 11208 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11209 | { |
| 11210 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11211 | |
| 11212 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11213 | alc262_hp_master_update(codec); |
| 11214 | } |
| 11215 | |
| 11216 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11217 | unsigned int res) |
| 11218 | { |
| 11219 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11220 | return; |
| 11221 | alc262_hp_wildwest_automute(codec); |
| 11222 | } |
| 11223 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11224 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11225 | |
| 11226 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11227 | struct snd_ctl_elem_value *ucontrol) |
| 11228 | { |
| 11229 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11230 | struct alc_spec *spec = codec->spec; |
| 11231 | int val = !!*ucontrol->value.integer.value; |
| 11232 | |
| 11233 | if (val == spec->master_sw) |
| 11234 | return 0; |
| 11235 | spec->master_sw = val; |
| 11236 | alc262_hp_master_update(codec); |
| 11237 | return 1; |
| 11238 | } |
| 11239 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11240 | #define ALC262_HP_MASTER_SWITCH \ |
| 11241 | { \ |
| 11242 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11243 | .name = "Master Playback Switch", \ |
| 11244 | .info = snd_ctl_boolean_mono_info, \ |
| 11245 | .get = alc262_hp_master_sw_get, \ |
| 11246 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11247 | }, \ |
| 11248 | { \ |
| 11249 | .iface = NID_MAPPING, \ |
| 11250 | .name = "Master Playback Switch", \ |
| 11251 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11252 | } |
| 11253 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11254 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11255 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11256 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11257 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11258 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11259 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11260 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11261 | HDA_OUTPUT), |
| 11262 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11263 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11264 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11265 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11266 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11267 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11268 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11269 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11270 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11271 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11272 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11273 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11274 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11275 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11276 | { } /* end */ |
| 11277 | }; |
| 11278 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11279 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11280 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11281 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11282 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11283 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11284 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11285 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11286 | HDA_OUTPUT), |
| 11287 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11288 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11289 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11290 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11291 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11292 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11293 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11294 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11295 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11296 | { } /* end */ |
| 11297 | }; |
| 11298 | |
| 11299 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11300 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11301 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11302 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11303 | { } /* end */ |
| 11304 | }; |
| 11305 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11306 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11307 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11308 | { |
| 11309 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11310 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11311 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11312 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11313 | } |
| 11314 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11315 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11316 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11317 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11318 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11319 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11320 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11321 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11322 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11323 | { } /* end */ |
| 11324 | }; |
| 11325 | |
| 11326 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11328 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11329 | |
| 11330 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11331 | { } |
| 11332 | }; |
| 11333 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11334 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11335 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11336 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11337 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11338 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11339 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11340 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11341 | { } /* end */ |
| 11342 | }; |
| 11343 | |
| 11344 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11345 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11346 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11347 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11348 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11349 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11350 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11351 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11352 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11353 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11354 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11355 | {} |
| 11356 | }; |
| 11357 | |
| 11358 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11359 | .num_items = 1, |
| 11360 | .items = { |
| 11361 | { "Line", 0x1 }, |
| 11362 | }, |
| 11363 | }; |
| 11364 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11365 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11366 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11367 | { |
| 11368 | struct alc_spec *spec = codec->spec; |
| 11369 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11370 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11371 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11372 | unsigned int mute; |
| 11373 | |
| 11374 | /* HP */ |
| 11375 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11376 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11377 | HDA_AMP_MUTE, mute); |
| 11378 | /* mute internal speaker per jack sense */ |
| 11379 | if (spec->jack_present) |
| 11380 | mute = HDA_AMP_MUTE; |
| 11381 | if (line_nid) |
| 11382 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11383 | HDA_AMP_MUTE, mute); |
| 11384 | if (speaker_nid && speaker_nid != line_nid) |
| 11385 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11386 | HDA_AMP_MUTE, mute); |
| 11387 | } |
| 11388 | |
| 11389 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11390 | |
| 11391 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11392 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11393 | { |
| 11394 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11395 | struct alc_spec *spec = codec->spec; |
| 11396 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11397 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11398 | if (val == spec->master_sw) |
| 11399 | return 0; |
| 11400 | spec->master_sw = val; |
| 11401 | alc262_hippo_master_update(codec); |
| 11402 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11403 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11404 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11405 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11406 | { \ |
| 11407 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11408 | .name = "Master Playback Switch", \ |
| 11409 | .info = snd_ctl_boolean_mono_info, \ |
| 11410 | .get = alc262_hippo_master_sw_get, \ |
| 11411 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11412 | }, \ |
| 11413 | { \ |
| 11414 | .iface = NID_MAPPING, \ |
| 11415 | .name = "Master Playback Switch", \ |
| 11416 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11417 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11418 | } |
| 11419 | |
| 11420 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11421 | ALC262_HIPPO_MASTER_SWITCH, |
| 11422 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11423 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11424 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11425 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11426 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11427 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11428 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11429 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11430 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11431 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11432 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11433 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11434 | { } /* end */ |
| 11435 | }; |
| 11436 | |
| 11437 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11438 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11439 | ALC262_HIPPO_MASTER_SWITCH, |
| 11440 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11441 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11442 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11443 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11444 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11445 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11446 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11447 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11448 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11449 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11450 | { } /* end */ |
| 11451 | }; |
| 11452 | |
| 11453 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11454 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11455 | { |
| 11456 | struct alc_spec *spec = codec->spec; |
| 11457 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11458 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11459 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11460 | alc262_hippo_master_update(codec); |
| 11461 | } |
| 11462 | |
| 11463 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11464 | { |
| 11465 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11466 | return; |
| 11467 | alc262_hippo_automute(codec); |
| 11468 | } |
| 11469 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11470 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11471 | { |
| 11472 | struct alc_spec *spec = codec->spec; |
| 11473 | |
| 11474 | spec->autocfg.hp_pins[0] = 0x15; |
| 11475 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11476 | } |
| 11477 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11478 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11479 | { |
| 11480 | struct alc_spec *spec = codec->spec; |
| 11481 | |
| 11482 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11483 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11484 | } |
| 11485 | |
| 11486 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11487 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11488 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11489 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11490 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11491 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11492 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11493 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11494 | { } /* end */ |
| 11495 | }; |
| 11496 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11497 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11498 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11499 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11500 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11503 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11504 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11505 | { } /* end */ |
| 11506 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11507 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11508 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11509 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11510 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11511 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11512 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11513 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11514 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11515 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11516 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11517 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11518 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11519 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11520 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11521 | { } /* end */ |
| 11522 | }; |
| 11523 | |
| 11524 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11525 | /* Headphone automute */ |
| 11526 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11527 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11528 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11529 | |
| 11530 | /* P11 AUX_IN, white 4-pin connector */ |
| 11531 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11532 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11533 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11534 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11535 | |
| 11536 | {} |
| 11537 | }; |
| 11538 | |
| 11539 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11540 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11541 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11542 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11543 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11544 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11545 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11546 | } |
| 11547 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11548 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11549 | #define alc262_capture_mixer alc882_capture_mixer |
| 11550 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11551 | |
| 11552 | /* |
| 11553 | * generic initialization of ADC, input mixers and output mixers |
| 11554 | */ |
| 11555 | static struct hda_verb alc262_init_verbs[] = { |
| 11556 | /* |
| 11557 | * Unmute ADC0-2 and set the default input to mic-in |
| 11558 | */ |
| 11559 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11560 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11561 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11562 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11563 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11564 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11565 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11566 | /* 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] | 11567 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11568 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11569 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11570 | */ |
| 11571 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11572 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11573 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11574 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11575 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11576 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11577 | |
| 11578 | /* |
| 11579 | * Set up output mixers (0x0c - 0x0e) |
| 11580 | */ |
| 11581 | /* set vol=0 to output mixers */ |
| 11582 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11583 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11584 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11585 | /* set up input amps for analog loopback */ |
| 11586 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11588 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11589 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11590 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11591 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11592 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11593 | |
| 11594 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11595 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11596 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11597 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11598 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11599 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11600 | |
| 11601 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11602 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11603 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11604 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11605 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11606 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11607 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11608 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11609 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11610 | /* FIXME: use matrix-type input source selection */ |
| 11611 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11612 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11613 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11614 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11615 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11616 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11617 | /* Input mixer2 */ |
| 11618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11619 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11620 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11621 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11622 | /* Input mixer3 */ |
| 11623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11625 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11626 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11627 | |
| 11628 | { } |
| 11629 | }; |
| 11630 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11631 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11632 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11633 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11634 | { } |
| 11635 | }; |
| 11636 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11637 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11638 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11639 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11640 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11641 | |
| 11642 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11643 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11644 | {} |
| 11645 | }; |
| 11646 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11647 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11648 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11649 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11650 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11651 | |
| 11652 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11653 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11654 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11655 | }; |
| 11656 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11657 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11658 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11659 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11660 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11661 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11662 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11663 | { } /* end */ |
| 11664 | }; |
| 11665 | |
| 11666 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11667 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11668 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11669 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11670 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11671 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11672 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11673 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11674 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11675 | {} |
| 11676 | }; |
| 11677 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11678 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11679 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11680 | struct alc_spec *spec = codec->spec; |
| 11681 | |
| 11682 | spec->autocfg.hp_pins[0] = 0x15; |
| 11683 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11684 | spec->ext_mic.pin = 0x18; |
| 11685 | spec->ext_mic.mux_idx = 0; |
| 11686 | spec->int_mic.pin = 0x12; |
| 11687 | spec->int_mic.mux_idx = 9; |
| 11688 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11689 | } |
| 11690 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11691 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11692 | * nec model |
| 11693 | * 0x15 = headphone |
| 11694 | * 0x16 = internal speaker |
| 11695 | * 0x18 = external mic |
| 11696 | */ |
| 11697 | |
| 11698 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11699 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11700 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11701 | |
| 11702 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11703 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11704 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11705 | |
| 11706 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11707 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11708 | { } /* end */ |
| 11709 | }; |
| 11710 | |
| 11711 | static struct hda_verb alc262_nec_verbs[] = { |
| 11712 | /* Unmute Speaker */ |
| 11713 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11714 | |
| 11715 | /* Headphone */ |
| 11716 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11717 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11718 | |
| 11719 | /* External mic to headphone */ |
| 11720 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11721 | /* External mic to speaker */ |
| 11722 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11723 | {} |
| 11724 | }; |
| 11725 | |
| 11726 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11727 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11728 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11729 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11730 | */ |
| 11731 | |
| 11732 | #define ALC_HP_EVENT 0x37 |
| 11733 | |
| 11734 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11735 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11736 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11737 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11738 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11739 | {} |
| 11740 | }; |
| 11741 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11742 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11743 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11744 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11745 | {} |
| 11746 | }; |
| 11747 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11748 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11749 | /* Front Mic pin: input vref at 50% */ |
| 11750 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11751 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11752 | {} |
| 11753 | }; |
| 11754 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11755 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11756 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11757 | .items = { |
| 11758 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11759 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11760 | { "CD", 0x4 }, |
| 11761 | }, |
| 11762 | }; |
| 11763 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11764 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11765 | .num_items = 5, |
| 11766 | .items = { |
| 11767 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11768 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11769 | { "Line", 0x2 }, |
| 11770 | { "CD", 0x4 }, |
| 11771 | { "AUX IN", 0x6 }, |
| 11772 | }, |
| 11773 | }; |
| 11774 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11775 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11776 | .num_items = 4, |
| 11777 | .items = { |
| 11778 | { "Mic", 0x0 }, |
| 11779 | { "Front Mic", 0x2 }, |
| 11780 | { "Line", 0x1 }, |
| 11781 | { "CD", 0x4 }, |
| 11782 | }, |
| 11783 | }; |
| 11784 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11785 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11786 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11787 | { |
| 11788 | struct alc_spec *spec = codec->spec; |
| 11789 | unsigned int mute; |
| 11790 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11791 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11792 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11793 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11794 | spec->sense_updated = 1; |
| 11795 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11796 | /* unmute internal speaker only if both HPs are unplugged and |
| 11797 | * master switch is on |
| 11798 | */ |
| 11799 | if (spec->jack_present) |
| 11800 | mute = HDA_AMP_MUTE; |
| 11801 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11802 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11803 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11804 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11805 | } |
| 11806 | |
| 11807 | /* unsolicited event for HP jack sensing */ |
| 11808 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11809 | unsigned int res) |
| 11810 | { |
| 11811 | if ((res >> 26) != ALC_HP_EVENT) |
| 11812 | return; |
| 11813 | alc262_fujitsu_automute(codec, 1); |
| 11814 | } |
| 11815 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11816 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11817 | { |
| 11818 | alc262_fujitsu_automute(codec, 1); |
| 11819 | } |
| 11820 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11821 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11822 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11823 | .ops = &snd_hda_bind_vol, |
| 11824 | .values = { |
| 11825 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11826 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11827 | 0 |
| 11828 | }, |
| 11829 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11830 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11831 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11832 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11833 | { |
| 11834 | struct alc_spec *spec = codec->spec; |
| 11835 | unsigned int mute; |
| 11836 | |
| 11837 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11838 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11839 | spec->sense_updated = 1; |
| 11840 | } |
| 11841 | if (spec->jack_present) { |
| 11842 | /* mute internal speaker */ |
| 11843 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11844 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11845 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11846 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11847 | } else { |
| 11848 | /* unmute internal speaker if necessary */ |
| 11849 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11850 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11851 | HDA_AMP_MUTE, mute); |
| 11852 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11853 | HDA_AMP_MUTE, mute); |
| 11854 | } |
| 11855 | } |
| 11856 | |
| 11857 | /* unsolicited event for HP jack sensing */ |
| 11858 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11859 | unsigned int res) |
| 11860 | { |
| 11861 | if ((res >> 26) != ALC_HP_EVENT) |
| 11862 | return; |
| 11863 | alc262_lenovo_3000_automute(codec, 1); |
| 11864 | } |
| 11865 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11866 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11867 | int dir, int idx, long *valp) |
| 11868 | { |
| 11869 | int i, change = 0; |
| 11870 | |
| 11871 | for (i = 0; i < 2; i++, valp++) |
| 11872 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11873 | HDA_AMP_MUTE, |
| 11874 | *valp ? 0 : HDA_AMP_MUTE); |
| 11875 | return change; |
| 11876 | } |
| 11877 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11878 | /* bind hp and internal speaker mute (with plug check) */ |
| 11879 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11880 | struct snd_ctl_elem_value *ucontrol) |
| 11881 | { |
| 11882 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11883 | long *valp = ucontrol->value.integer.value; |
| 11884 | int change; |
| 11885 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11886 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11887 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11888 | if (change) |
| 11889 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11890 | return change; |
| 11891 | } |
| 11892 | |
| 11893 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11894 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11895 | { |
| 11896 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11897 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11898 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11899 | .info = snd_hda_mixer_amp_switch_info, |
| 11900 | .get = snd_hda_mixer_amp_switch_get, |
| 11901 | .put = alc262_fujitsu_master_sw_put, |
| 11902 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11903 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11904 | { |
| 11905 | .iface = NID_MAPPING, |
| 11906 | .name = "Master Playback Switch", |
| 11907 | .private_value = 0x1b, |
| 11908 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11909 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11910 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11911 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11914 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11915 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11916 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11917 | { } /* end */ |
| 11918 | }; |
| 11919 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11920 | /* bind hp and internal speaker mute (with plug check) */ |
| 11921 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11922 | struct snd_ctl_elem_value *ucontrol) |
| 11923 | { |
| 11924 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11925 | long *valp = ucontrol->value.integer.value; |
| 11926 | int change; |
| 11927 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11928 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11929 | if (change) |
| 11930 | alc262_lenovo_3000_automute(codec, 0); |
| 11931 | return change; |
| 11932 | } |
| 11933 | |
| 11934 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11935 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11936 | { |
| 11937 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11938 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11939 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11940 | .info = snd_hda_mixer_amp_switch_info, |
| 11941 | .get = snd_hda_mixer_amp_switch_get, |
| 11942 | .put = alc262_lenovo_3000_master_sw_put, |
| 11943 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11944 | }, |
| 11945 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11946 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11947 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11948 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11949 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11950 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11951 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11952 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11953 | { } /* end */ |
| 11954 | }; |
| 11955 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11956 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11957 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11958 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11959 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11960 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11961 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11962 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11963 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11964 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11965 | { } /* end */ |
| 11966 | }; |
| 11967 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11968 | /* additional init verbs for Benq laptops */ |
| 11969 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11970 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11971 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11972 | {} |
| 11973 | }; |
| 11974 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11975 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11976 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11977 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11978 | |
| 11979 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11980 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11981 | {} |
| 11982 | }; |
| 11983 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11984 | /* Samsung Q1 Ultra Vista model setup */ |
| 11985 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11986 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11987 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11988 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11989 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11990 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 11991 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11992 | { } /* end */ |
| 11993 | }; |
| 11994 | |
| 11995 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11996 | /* output mixer */ |
| 11997 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11998 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11999 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12000 | /* speaker */ |
| 12001 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12002 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12003 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12004 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12005 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12006 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12007 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12008 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12009 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12010 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12011 | /* internal mic */ |
| 12012 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12013 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12014 | /* ADC, choose mic */ |
| 12015 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12016 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12017 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12018 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12019 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12020 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12021 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12022 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12023 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 12024 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12025 | {} |
| 12026 | }; |
| 12027 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12028 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12029 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 12030 | { |
| 12031 | struct alc_spec *spec = codec->spec; |
| 12032 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12033 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12034 | mute = 0; |
| 12035 | /* auto-mute only when HP is used as HP */ |
| 12036 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12037 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12038 | if (spec->jack_present) |
| 12039 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12040 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12041 | /* mute/unmute internal speaker */ |
| 12042 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12043 | HDA_AMP_MUTE, mute); |
| 12044 | /* mute/unmute HP */ |
| 12045 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12046 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12047 | } |
| 12048 | |
| 12049 | /* unsolicited event for HP jack sensing */ |
| 12050 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 12051 | unsigned int res) |
| 12052 | { |
| 12053 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12054 | return; |
| 12055 | alc262_ultra_automute(codec); |
| 12056 | } |
| 12057 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12058 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 12059 | .num_items = 2, |
| 12060 | .items = { |
| 12061 | { "Mic", 0x1 }, |
| 12062 | { "Headphone", 0x7 }, |
| 12063 | }, |
| 12064 | }; |
| 12065 | |
| 12066 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12067 | struct snd_ctl_elem_value *ucontrol) |
| 12068 | { |
| 12069 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12070 | struct alc_spec *spec = codec->spec; |
| 12071 | int ret; |
| 12072 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12073 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12074 | if (!ret) |
| 12075 | return 0; |
| 12076 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12077 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12078 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12079 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12080 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12081 | return ret; |
| 12082 | } |
| 12083 | |
| 12084 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12085 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12086 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12087 | { |
| 12088 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12089 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12090 | .info = alc_mux_enum_info, |
| 12091 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12092 | .put = alc262_ultra_mux_enum_put, |
| 12093 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12094 | { |
| 12095 | .iface = NID_MAPPING, |
| 12096 | .name = "Capture Source", |
| 12097 | .private_value = 0x15, |
| 12098 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12099 | { } /* end */ |
| 12100 | }; |
| 12101 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12102 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12103 | * and thus it's bound with a different mixer. |
| 12104 | * This function returns which mixer amp should be used. |
| 12105 | */ |
| 12106 | static int alc262_check_volbit(hda_nid_t nid) |
| 12107 | { |
| 12108 | if (!nid) |
| 12109 | return 0; |
| 12110 | else if (nid == 0x16) |
| 12111 | return 2; |
| 12112 | else |
| 12113 | return 1; |
| 12114 | } |
| 12115 | |
| 12116 | 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] | 12117 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12118 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12119 | unsigned long val; |
| 12120 | int vbit; |
| 12121 | |
| 12122 | vbit = alc262_check_volbit(nid); |
| 12123 | if (!vbit) |
| 12124 | return 0; |
| 12125 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12126 | return 0; |
| 12127 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12128 | if (vbit == 2) |
| 12129 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12130 | else |
| 12131 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12132 | 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] | 12133 | } |
| 12134 | |
| 12135 | 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] | 12136 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12137 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12138 | unsigned long val; |
| 12139 | |
| 12140 | if (!nid) |
| 12141 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12142 | if (nid == 0x16) |
| 12143 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12144 | else |
| 12145 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12146 | 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] | 12147 | } |
| 12148 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12149 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12150 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12151 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12152 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12153 | const char *pfx; |
| 12154 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12155 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12156 | |
| 12157 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12158 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12159 | spec->multiout.dac_nids[0] = 2; |
| 12160 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12161 | pfx = alc_get_line_out_pfx(cfg, true); |
| 12162 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12163 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12164 | for (i = 0; i < 2; i++) { |
| 12165 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12166 | if (err < 0) |
| 12167 | return err; |
| 12168 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12169 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12170 | "Speaker", i); |
| 12171 | if (err < 0) |
| 12172 | return err; |
| 12173 | } |
| 12174 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12175 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12176 | "Headphone", i); |
| 12177 | if (err < 0) |
| 12178 | return err; |
| 12179 | } |
| 12180 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12181 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12182 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12183 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12184 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12185 | if (vbits == 1 || vbits == 2) |
| 12186 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12187 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12188 | for (i = 0; i < 2; i++) { |
| 12189 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12190 | &vbits, i); |
| 12191 | if (err < 0) |
| 12192 | return err; |
| 12193 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12194 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12195 | "Speaker", &vbits, i); |
| 12196 | if (err < 0) |
| 12197 | return err; |
| 12198 | } |
| 12199 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12200 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12201 | "Headphone", &vbits, i); |
| 12202 | if (err < 0) |
| 12203 | return err; |
| 12204 | } |
| 12205 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12206 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12207 | } |
| 12208 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12209 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12210 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12211 | |
| 12212 | /* |
| 12213 | * generic initialization of ADC, input mixers and output mixers |
| 12214 | */ |
| 12215 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12216 | /* |
| 12217 | * Unmute ADC0-2 and set the default input to mic-in |
| 12218 | */ |
| 12219 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12220 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12221 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12222 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12223 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12224 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12225 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12226 | /* 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] | 12227 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12228 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12229 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12230 | */ |
| 12231 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12232 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12233 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12234 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12235 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12236 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12237 | |
| 12238 | /* |
| 12239 | * Set up output mixers (0x0c - 0x0f) |
| 12240 | */ |
| 12241 | /* set vol=0 to output mixers */ |
| 12242 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12243 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12244 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12245 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12246 | /* set up input amps for analog loopback */ |
| 12247 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12248 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12249 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12250 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12251 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12252 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12253 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12254 | |
| 12255 | /* FIXME: use matrix-type input source selection */ |
| 12256 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12257 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12258 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12259 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12260 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12261 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12262 | /* Input mixer2 */ |
| 12263 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12264 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12265 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12266 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12267 | /* Input mixer3 */ |
| 12268 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12269 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12270 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12271 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12272 | |
| 12273 | { } |
| 12274 | }; |
| 12275 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12276 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12277 | /* |
| 12278 | * Unmute ADC0-2 and set the default input to mic-in |
| 12279 | */ |
| 12280 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12281 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12282 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12283 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12284 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12285 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12286 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12287 | /* 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] | 12288 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12289 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12290 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12291 | */ |
| 12292 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12295 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12296 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12297 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12298 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12299 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12300 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12301 | /* |
| 12302 | * Set up output mixers (0x0c - 0x0e) |
| 12303 | */ |
| 12304 | /* set vol=0 to output mixers */ |
| 12305 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12306 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12307 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12308 | |
| 12309 | /* set up input amps for analog loopback */ |
| 12310 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12311 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12312 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12313 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12314 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12315 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12316 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12317 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12318 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12319 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12320 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12321 | |
| 12322 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12323 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12324 | |
| 12325 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12326 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12327 | |
| 12328 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12329 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12330 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12331 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12332 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12333 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12334 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12335 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12336 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12337 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12338 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12339 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12340 | |
| 12341 | |
| 12342 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12343 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12344 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12345 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12346 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12347 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12348 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12349 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12350 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12351 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12352 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12353 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12354 | /* Input mixer2 */ |
| 12355 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12356 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12357 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12358 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12359 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12360 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12361 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12362 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12364 | /* Input mixer3 */ |
| 12365 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12366 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12367 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12368 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12369 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12370 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12373 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12374 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12375 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12376 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12377 | { } |
| 12378 | }; |
| 12379 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12380 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12381 | /* |
| 12382 | * Unmute ADC0-2 and set the default input to mic-in |
| 12383 | */ |
| 12384 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12386 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12387 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12388 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12389 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12390 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12391 | /* 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] | 12392 | * mixer widget |
| 12393 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12394 | * panel mic (mic 2) |
| 12395 | */ |
| 12396 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12397 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12398 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12399 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12400 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12401 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12402 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12403 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12404 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12405 | /* |
| 12406 | * Set up output mixers (0x0c - 0x0e) |
| 12407 | */ |
| 12408 | /* set vol=0 to output mixers */ |
| 12409 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12410 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12411 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12412 | |
| 12413 | /* set up input amps for analog loopback */ |
| 12414 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12415 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12416 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12417 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12418 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12419 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12420 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12421 | |
| 12422 | |
| 12423 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12424 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12425 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12426 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12427 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12428 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12429 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12430 | |
| 12431 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12432 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12433 | |
| 12434 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12435 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12436 | |
| 12437 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12438 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12439 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12440 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12441 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12442 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12443 | |
| 12444 | /* FIXME: use matrix-type input source selection */ |
| 12445 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12446 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12447 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12448 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12449 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12450 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12451 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12452 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12453 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12454 | /* Input mixer2 */ |
| 12455 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12456 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12457 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12458 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12459 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12460 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12461 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12462 | /* Input mixer3 */ |
| 12463 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12464 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12465 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12466 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12467 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12468 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12470 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12471 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12472 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12473 | { } |
| 12474 | }; |
| 12475 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12476 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12477 | |
| 12478 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12479 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12480 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12481 | |
| 12482 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12483 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12484 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12485 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12486 | |
| 12487 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12488 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12489 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12490 | {} |
| 12491 | }; |
| 12492 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12493 | /* |
| 12494 | * Pin config fixes |
| 12495 | */ |
| 12496 | enum { |
| 12497 | PINFIX_FSC_H270, |
| 12498 | }; |
| 12499 | |
| 12500 | static const struct alc_fixup alc262_fixups[] = { |
| 12501 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12502 | .type = ALC_FIXUP_PINS, |
| 12503 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12504 | { 0x14, 0x99130110 }, /* speaker */ |
| 12505 | { 0x15, 0x0221142f }, /* front HP */ |
| 12506 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12507 | { } |
| 12508 | } |
| 12509 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12510 | }; |
| 12511 | |
| 12512 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12513 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12514 | {} |
| 12515 | }; |
| 12516 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12517 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12518 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12519 | #define alc262_loopbacks alc880_loopbacks |
| 12520 | #endif |
| 12521 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12522 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12523 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12524 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12525 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12526 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12527 | |
| 12528 | /* |
| 12529 | * BIOS auto configuration |
| 12530 | */ |
| 12531 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12532 | { |
| 12533 | struct alc_spec *spec = codec->spec; |
| 12534 | int err; |
| 12535 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12536 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12537 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12538 | alc262_ignore); |
| 12539 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12540 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12541 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12542 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12543 | spec->multiout.max_channels = 2; |
| 12544 | spec->no_analog = 1; |
| 12545 | goto dig_only; |
| 12546 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12547 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12548 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12549 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12550 | if (err < 0) |
| 12551 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12552 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12553 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12554 | return err; |
| 12555 | |
| 12556 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12557 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12558 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12559 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12560 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12561 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12562 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12563 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12564 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12565 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12566 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12567 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12568 | err = alc_auto_add_mic_boost(codec); |
| 12569 | if (err < 0) |
| 12570 | return err; |
| 12571 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12572 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12573 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12574 | return 1; |
| 12575 | } |
| 12576 | |
| 12577 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12578 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12579 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12580 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12581 | |
| 12582 | |
| 12583 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12584 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12585 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12586 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12587 | alc262_auto_init_multi_out(codec); |
| 12588 | alc262_auto_init_hp_out(codec); |
| 12589 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12590 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12591 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12592 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12593 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12594 | } |
| 12595 | |
| 12596 | /* |
| 12597 | * configuration and preset |
| 12598 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12599 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12600 | [ALC262_BASIC] = "basic", |
| 12601 | [ALC262_HIPPO] = "hippo", |
| 12602 | [ALC262_HIPPO_1] = "hippo_1", |
| 12603 | [ALC262_FUJITSU] = "fujitsu", |
| 12604 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12605 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12606 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12607 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12608 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12609 | [ALC262_BENQ_T31] = "benq-t31", |
| 12610 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12611 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12612 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12613 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12614 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12615 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12616 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12617 | [ALC262_AUTO] = "auto", |
| 12618 | }; |
| 12619 | |
| 12620 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12621 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12622 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12623 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12624 | ALC262_HP_BPC), |
| 12625 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12626 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12627 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12628 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12629 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12630 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12631 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12632 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12633 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12634 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12635 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12636 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12637 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12638 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12639 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12640 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12641 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12642 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12643 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12644 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12645 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12646 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12647 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12648 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12649 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12650 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12651 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12652 | #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] | 12653 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12654 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12655 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12656 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12657 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12658 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12659 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12660 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12661 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12662 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12663 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12664 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12665 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12666 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12667 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12668 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12669 | {} |
| 12670 | }; |
| 12671 | |
| 12672 | static struct alc_config_preset alc262_presets[] = { |
| 12673 | [ALC262_BASIC] = { |
| 12674 | .mixers = { alc262_base_mixer }, |
| 12675 | .init_verbs = { alc262_init_verbs }, |
| 12676 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12677 | .dac_nids = alc262_dac_nids, |
| 12678 | .hp_nid = 0x03, |
| 12679 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12680 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12681 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12682 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12683 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12684 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12685 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12686 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12687 | .dac_nids = alc262_dac_nids, |
| 12688 | .hp_nid = 0x03, |
| 12689 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12690 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12691 | .channel_mode = alc262_modes, |
| 12692 | .input_mux = &alc262_capture_source, |
| 12693 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12694 | .setup = alc262_hippo_setup, |
| 12695 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12696 | }, |
| 12697 | [ALC262_HIPPO_1] = { |
| 12698 | .mixers = { alc262_hippo1_mixer }, |
| 12699 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12700 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12701 | .dac_nids = alc262_dac_nids, |
| 12702 | .hp_nid = 0x02, |
| 12703 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12704 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12705 | .channel_mode = alc262_modes, |
| 12706 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12707 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12708 | .setup = alc262_hippo1_setup, |
| 12709 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12710 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12711 | [ALC262_FUJITSU] = { |
| 12712 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12713 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12714 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12715 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12716 | .dac_nids = alc262_dac_nids, |
| 12717 | .hp_nid = 0x03, |
| 12718 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12719 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12720 | .channel_mode = alc262_modes, |
| 12721 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12722 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12723 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12724 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12725 | [ALC262_HP_BPC] = { |
| 12726 | .mixers = { alc262_HP_BPC_mixer }, |
| 12727 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12728 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12729 | .dac_nids = alc262_dac_nids, |
| 12730 | .hp_nid = 0x03, |
| 12731 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12732 | .channel_mode = alc262_modes, |
| 12733 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12734 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12735 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12736 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12737 | [ALC262_HP_BPC_D7000_WF] = { |
| 12738 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12739 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12740 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12741 | .dac_nids = alc262_dac_nids, |
| 12742 | .hp_nid = 0x03, |
| 12743 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12744 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12745 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12746 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12747 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12748 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12749 | [ALC262_HP_BPC_D7000_WL] = { |
| 12750 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12751 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12752 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12753 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12754 | .dac_nids = alc262_dac_nids, |
| 12755 | .hp_nid = 0x03, |
| 12756 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12757 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12758 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12759 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12760 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12761 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12762 | [ALC262_HP_TC_T5735] = { |
| 12763 | .mixers = { alc262_hp_t5735_mixer }, |
| 12764 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12765 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12766 | .dac_nids = alc262_dac_nids, |
| 12767 | .hp_nid = 0x03, |
| 12768 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12769 | .channel_mode = alc262_modes, |
| 12770 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12771 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12772 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12773 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12774 | }, |
| 12775 | [ALC262_HP_RP5700] = { |
| 12776 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12777 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12778 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12779 | .dac_nids = alc262_dac_nids, |
| 12780 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12781 | .channel_mode = alc262_modes, |
| 12782 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12783 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12784 | [ALC262_BENQ_ED8] = { |
| 12785 | .mixers = { alc262_base_mixer }, |
| 12786 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12787 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12788 | .dac_nids = alc262_dac_nids, |
| 12789 | .hp_nid = 0x03, |
| 12790 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12791 | .channel_mode = alc262_modes, |
| 12792 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12793 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12794 | [ALC262_SONY_ASSAMD] = { |
| 12795 | .mixers = { alc262_sony_mixer }, |
| 12796 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12797 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12798 | .dac_nids = alc262_dac_nids, |
| 12799 | .hp_nid = 0x02, |
| 12800 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12801 | .channel_mode = alc262_modes, |
| 12802 | .input_mux = &alc262_capture_source, |
| 12803 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12804 | .setup = alc262_hippo_setup, |
| 12805 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12806 | }, |
| 12807 | [ALC262_BENQ_T31] = { |
| 12808 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12809 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12810 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12811 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12812 | .dac_nids = alc262_dac_nids, |
| 12813 | .hp_nid = 0x03, |
| 12814 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12815 | .channel_mode = alc262_modes, |
| 12816 | .input_mux = &alc262_capture_source, |
| 12817 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12818 | .setup = alc262_hippo_setup, |
| 12819 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12820 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12821 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12822 | .mixers = { alc262_ultra_mixer }, |
| 12823 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12824 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12825 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12826 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12827 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12828 | .channel_mode = alc262_modes, |
| 12829 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12830 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12831 | .capsrc_nids = alc262_capsrc_nids, |
| 12832 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12833 | .unsol_event = alc262_ultra_unsol_event, |
| 12834 | .init_hook = alc262_ultra_automute, |
| 12835 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12836 | [ALC262_LENOVO_3000] = { |
| 12837 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12838 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12839 | alc262_lenovo_3000_unsol_verbs, |
| 12840 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12841 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12842 | .dac_nids = alc262_dac_nids, |
| 12843 | .hp_nid = 0x03, |
| 12844 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12845 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12846 | .channel_mode = alc262_modes, |
| 12847 | .input_mux = &alc262_fujitsu_capture_source, |
| 12848 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12849 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12850 | [ALC262_NEC] = { |
| 12851 | .mixers = { alc262_nec_mixer }, |
| 12852 | .init_verbs = { alc262_nec_verbs }, |
| 12853 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12854 | .dac_nids = alc262_dac_nids, |
| 12855 | .hp_nid = 0x03, |
| 12856 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12857 | .channel_mode = alc262_modes, |
| 12858 | .input_mux = &alc262_capture_source, |
| 12859 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12860 | [ALC262_TOSHIBA_S06] = { |
| 12861 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12862 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12863 | alc262_eapd_verbs }, |
| 12864 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12865 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12866 | .dac_nids = alc262_dac_nids, |
| 12867 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12868 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12869 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12870 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12871 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12872 | .unsol_event = alc_sku_unsol_event, |
| 12873 | .setup = alc262_toshiba_s06_setup, |
| 12874 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12875 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12876 | [ALC262_TOSHIBA_RX1] = { |
| 12877 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12878 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12879 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12880 | .dac_nids = alc262_dac_nids, |
| 12881 | .hp_nid = 0x03, |
| 12882 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12883 | .channel_mode = alc262_modes, |
| 12884 | .input_mux = &alc262_capture_source, |
| 12885 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12886 | .setup = alc262_hippo_setup, |
| 12887 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12888 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12889 | [ALC262_TYAN] = { |
| 12890 | .mixers = { alc262_tyan_mixer }, |
| 12891 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12892 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12893 | .dac_nids = alc262_dac_nids, |
| 12894 | .hp_nid = 0x02, |
| 12895 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12896 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12897 | .channel_mode = alc262_modes, |
| 12898 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12899 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12900 | .setup = alc262_tyan_setup, |
| 12901 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12902 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12903 | }; |
| 12904 | |
| 12905 | static int patch_alc262(struct hda_codec *codec) |
| 12906 | { |
| 12907 | struct alc_spec *spec; |
| 12908 | int board_config; |
| 12909 | int err; |
| 12910 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12911 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12912 | if (spec == NULL) |
| 12913 | return -ENOMEM; |
| 12914 | |
| 12915 | codec->spec = spec; |
| 12916 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12917 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12918 | * under-run |
| 12919 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12920 | { |
| 12921 | int tmp; |
| 12922 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12923 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12924 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12925 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12926 | } |
| 12927 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12928 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12929 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12930 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12931 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12932 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12933 | alc262_models, |
| 12934 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12935 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12936 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12937 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12938 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12939 | board_config = ALC262_AUTO; |
| 12940 | } |
| 12941 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12942 | if (board_config == ALC262_AUTO) { |
| 12943 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12944 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12945 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12946 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12947 | if (board_config == ALC262_AUTO) { |
| 12948 | /* automatic parse from the BIOS config */ |
| 12949 | err = alc262_parse_auto_config(codec); |
| 12950 | if (err < 0) { |
| 12951 | alc_free(codec); |
| 12952 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12953 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12954 | printk(KERN_INFO |
| 12955 | "hda_codec: Cannot set up configuration " |
| 12956 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12957 | board_config = ALC262_BASIC; |
| 12958 | } |
| 12959 | } |
| 12960 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12961 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12962 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12963 | if (err < 0) { |
| 12964 | alc_free(codec); |
| 12965 | return err; |
| 12966 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12967 | } |
| 12968 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12969 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12970 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12971 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12972 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12973 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12974 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12975 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12976 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12977 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12978 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12979 | int i; |
| 12980 | /* check whether the digital-mic has to be supported */ |
| 12981 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12982 | if (spec->input_mux->items[i].index >= 9) |
| 12983 | break; |
| 12984 | } |
| 12985 | if (i < spec->input_mux->num_items) { |
| 12986 | /* use only ADC0 */ |
| 12987 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12988 | spec->num_adc_nids = 1; |
| 12989 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12990 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12991 | /* all analog inputs */ |
| 12992 | /* check whether NID 0x07 is valid */ |
| 12993 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12994 | |
| 12995 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12996 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12997 | if (wcap != AC_WID_AUD_IN) { |
| 12998 | spec->adc_nids = alc262_adc_nids_alt; |
| 12999 | spec->num_adc_nids = |
| 13000 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 13001 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 13002 | } else { |
| 13003 | spec->adc_nids = alc262_adc_nids; |
| 13004 | spec->num_adc_nids = |
| 13005 | ARRAY_SIZE(alc262_adc_nids); |
| 13006 | spec->capsrc_nids = alc262_capsrc_nids; |
| 13007 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13008 | } |
| 13009 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 13010 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13011 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13012 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13013 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13014 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 13015 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 13016 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13017 | spec->vmaster_nid = 0x0c; |
| 13018 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13019 | codec->patch_ops = alc_patch_ops; |
| 13020 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13021 | spec->init_hook = alc262_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13022 | |
| 13023 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13024 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13025 | if (!spec->loopback.amplist) |
| 13026 | spec->loopback.amplist = alc262_loopbacks; |
| 13027 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13028 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13029 | return 0; |
| 13030 | } |
| 13031 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13032 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13033 | * ALC268 channel source setting (2 channel) |
| 13034 | */ |
| 13035 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 13036 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13037 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13038 | static hda_nid_t alc268_dac_nids[2] = { |
| 13039 | /* front, hp */ |
| 13040 | 0x02, 0x03 |
| 13041 | }; |
| 13042 | |
| 13043 | static hda_nid_t alc268_adc_nids[2] = { |
| 13044 | /* ADC0-1 */ |
| 13045 | 0x08, 0x07 |
| 13046 | }; |
| 13047 | |
| 13048 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 13049 | /* ADC0 */ |
| 13050 | 0x08 |
| 13051 | }; |
| 13052 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13053 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 13054 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13055 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 13056 | /* output mixer control */ |
| 13057 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13058 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13059 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13060 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13061 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13062 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13063 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13064 | { } |
| 13065 | }; |
| 13066 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13067 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 13068 | /* output mixer control */ |
| 13069 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13070 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13071 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13072 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13073 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13074 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13075 | { } |
| 13076 | }; |
| 13077 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13078 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13079 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13080 | .ops = &snd_hda_bind_sw, |
| 13081 | .values = { |
| 13082 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13083 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13084 | 0 |
| 13085 | }, |
| 13086 | }; |
| 13087 | |
| 13088 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13089 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13090 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13091 | { } |
| 13092 | }; |
| 13093 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13094 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13095 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13096 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13097 | { } |
| 13098 | }; |
| 13099 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13100 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13101 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13102 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13103 | { } /* end */ |
| 13104 | }; |
| 13105 | |
| 13106 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13107 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13108 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13109 | .ops = &snd_hda_bind_vol, |
| 13110 | .values = { |
| 13111 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13112 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13113 | 0 |
| 13114 | }, |
| 13115 | }; |
| 13116 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13117 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 13118 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 13119 | { |
| 13120 | struct alc_spec *spec = codec->spec; |
| 13121 | unsigned int mute; |
| 13122 | |
| 13123 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13124 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13125 | spec->sense_updated = 1; |
| 13126 | } |
| 13127 | if (spec->jack_present) |
| 13128 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 13129 | else /* unmute internal speaker if necessary */ |
| 13130 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13131 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13132 | HDA_AMP_MUTE, mute); |
| 13133 | } |
| 13134 | |
| 13135 | |
| 13136 | /* bind hp and internal speaker mute (with plug check) */ |
| 13137 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 13138 | struct snd_ctl_elem_value *ucontrol) |
| 13139 | { |
| 13140 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 13141 | long *valp = ucontrol->value.integer.value; |
| 13142 | int change; |
| 13143 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 13144 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13145 | if (change) |
| 13146 | alc268_acer_automute(codec, 0); |
| 13147 | return change; |
| 13148 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13149 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13150 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13151 | /* output mixer control */ |
| 13152 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13153 | { |
| 13154 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13155 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13156 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13157 | .info = snd_hda_mixer_amp_switch_info, |
| 13158 | .get = snd_hda_mixer_amp_switch_get, |
| 13159 | .put = alc268_acer_master_sw_put, |
| 13160 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13161 | }, |
| 13162 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13163 | { } |
| 13164 | }; |
| 13165 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13166 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13167 | /* output mixer control */ |
| 13168 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13169 | { |
| 13170 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13171 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13172 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13173 | .info = snd_hda_mixer_amp_switch_info, |
| 13174 | .get = snd_hda_mixer_amp_switch_get, |
| 13175 | .put = alc268_acer_master_sw_put, |
| 13176 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13177 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13178 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13179 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13180 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13181 | { } |
| 13182 | }; |
| 13183 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13184 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13185 | /* output mixer control */ |
| 13186 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13187 | { |
| 13188 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13189 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13190 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13191 | .info = snd_hda_mixer_amp_switch_info, |
| 13192 | .get = snd_hda_mixer_amp_switch_get, |
| 13193 | .put = alc268_acer_master_sw_put, |
| 13194 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13195 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13196 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13197 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13198 | { } |
| 13199 | }; |
| 13200 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13201 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13202 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13203 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13204 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13205 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13206 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13207 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13208 | { } |
| 13209 | }; |
| 13210 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13211 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13212 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13213 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13214 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13215 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13216 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13217 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13218 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13219 | { } |
| 13220 | }; |
| 13221 | |
| 13222 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13223 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13224 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13225 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13226 | |
| 13227 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13228 | unsigned int res) |
| 13229 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13230 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13231 | return; |
| 13232 | alc268_acer_automute(codec, 1); |
| 13233 | } |
| 13234 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13235 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13236 | { |
| 13237 | alc268_acer_automute(codec, 1); |
| 13238 | } |
| 13239 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13240 | /* toggle speaker-output according to the hp-jack state */ |
| 13241 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13242 | { |
| 13243 | unsigned int present; |
| 13244 | unsigned char bits; |
| 13245 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13246 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13247 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13248 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13249 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13250 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13251 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13252 | } |
| 13253 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13254 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13255 | unsigned int res) |
| 13256 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13257 | switch (res >> 26) { |
| 13258 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13259 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13260 | break; |
| 13261 | case ALC880_MIC_EVENT: |
| 13262 | alc_mic_automute(codec); |
| 13263 | break; |
| 13264 | } |
| 13265 | } |
| 13266 | |
| 13267 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13268 | { |
| 13269 | struct alc_spec *spec = codec->spec; |
| 13270 | spec->ext_mic.pin = 0x18; |
| 13271 | spec->ext_mic.mux_idx = 0; |
| 13272 | spec->int_mic.pin = 0x12; |
| 13273 | spec->int_mic.mux_idx = 6; |
| 13274 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13275 | } |
| 13276 | |
| 13277 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13278 | { |
| 13279 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13280 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13281 | } |
| 13282 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13283 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13284 | /* output mixer control */ |
| 13285 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13286 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13287 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13288 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13289 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13290 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13291 | { } |
| 13292 | }; |
| 13293 | |
| 13294 | static struct hda_verb alc268_dell_verbs[] = { |
| 13295 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13296 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13297 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13298 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13299 | { } |
| 13300 | }; |
| 13301 | |
| 13302 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13303 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13304 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13305 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13306 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13307 | spec->autocfg.hp_pins[0] = 0x15; |
| 13308 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13309 | spec->ext_mic.pin = 0x18; |
| 13310 | spec->ext_mic.mux_idx = 0; |
| 13311 | spec->int_mic.pin = 0x19; |
| 13312 | spec->int_mic.mux_idx = 1; |
| 13313 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13314 | } |
| 13315 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13316 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13317 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13318 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13319 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13320 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13321 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13322 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13323 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13324 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13325 | { } |
| 13326 | }; |
| 13327 | |
| 13328 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13329 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13330 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13331 | { } |
| 13332 | }; |
| 13333 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13334 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13335 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13336 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13337 | spec->autocfg.hp_pins[0] = 0x15; |
| 13338 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13339 | spec->ext_mic.pin = 0x18; |
| 13340 | spec->ext_mic.mux_idx = 0; |
| 13341 | spec->int_mic.pin = 0x19; |
| 13342 | spec->int_mic.mux_idx = 1; |
| 13343 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13344 | } |
| 13345 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13346 | /* |
| 13347 | * generic initialization of ADC, input mixers and output mixers |
| 13348 | */ |
| 13349 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13350 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13351 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13352 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13353 | |
| 13354 | /* |
| 13355 | * Set up output mixers (0x0c - 0x0e) |
| 13356 | */ |
| 13357 | /* set vol=0 to output mixers */ |
| 13358 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13359 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13360 | |
| 13361 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13362 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13363 | |
| 13364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13365 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13366 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13367 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13368 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13369 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13370 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13371 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13372 | |
| 13373 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13374 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13375 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13376 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13377 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13378 | |
| 13379 | /* set PCBEEP vol = 0, mute connections */ |
| 13380 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13381 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13382 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13383 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13384 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13385 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13386 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13387 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13388 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13389 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13390 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13391 | { } |
| 13392 | }; |
| 13393 | |
| 13394 | /* |
| 13395 | * generic initialization of ADC, input mixers and output mixers |
| 13396 | */ |
| 13397 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13398 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13399 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13400 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13401 | |
| 13402 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13403 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13404 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13405 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13406 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13407 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13408 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13409 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13410 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13411 | |
| 13412 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13413 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13414 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13415 | /* set PCBEEP vol = 0, mute connections */ |
| 13416 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13417 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13418 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13419 | |
| 13420 | { } |
| 13421 | }; |
| 13422 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13423 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13424 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13425 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13426 | { } /* end */ |
| 13427 | }; |
| 13428 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13429 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13430 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13431 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13432 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13433 | { } /* end */ |
| 13434 | }; |
| 13435 | |
| 13436 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13437 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13438 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13439 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13440 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13441 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13442 | { } /* end */ |
| 13443 | }; |
| 13444 | |
| 13445 | static struct hda_input_mux alc268_capture_source = { |
| 13446 | .num_items = 4, |
| 13447 | .items = { |
| 13448 | { "Mic", 0x0 }, |
| 13449 | { "Front Mic", 0x1 }, |
| 13450 | { "Line", 0x2 }, |
| 13451 | { "CD", 0x3 }, |
| 13452 | }, |
| 13453 | }; |
| 13454 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13455 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13456 | .num_items = 3, |
| 13457 | .items = { |
| 13458 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13459 | { "Internal Mic", 0x1 }, |
| 13460 | { "Line", 0x2 }, |
| 13461 | }, |
| 13462 | }; |
| 13463 | |
| 13464 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13465 | .num_items = 3, |
| 13466 | .items = { |
| 13467 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13468 | { "Internal Mic", 0x6 }, |
| 13469 | { "Line", 0x2 }, |
| 13470 | }, |
| 13471 | }; |
| 13472 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13473 | #ifdef CONFIG_SND_DEBUG |
| 13474 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13475 | /* Volume widgets */ |
| 13476 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13477 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13478 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13479 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13480 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13481 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13482 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13483 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13484 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13485 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13486 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13487 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13488 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13489 | /* The below appears problematic on some hardwares */ |
| 13490 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13491 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13492 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13493 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13494 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13495 | |
| 13496 | /* Modes for retasking pin widgets */ |
| 13497 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13498 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13499 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13500 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13501 | |
| 13502 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13503 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13504 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13505 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13506 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13507 | |
| 13508 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13509 | * The ALC268 does not have an SPDIF input. |
| 13510 | */ |
| 13511 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13512 | |
| 13513 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13514 | * this output to turn on an external amplifier. |
| 13515 | */ |
| 13516 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13517 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13518 | |
| 13519 | { } /* end */ |
| 13520 | }; |
| 13521 | #endif |
| 13522 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13523 | /* create input playback/capture controls for the given pin */ |
| 13524 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13525 | const char *ctlname, int idx) |
| 13526 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13527 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13528 | int err; |
| 13529 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13530 | switch (nid) { |
| 13531 | case 0x14: |
| 13532 | case 0x16: |
| 13533 | dac = 0x02; |
| 13534 | break; |
| 13535 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13536 | case 0x1a: /* ALC259/269 only */ |
| 13537 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13538 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13539 | dac = 0x03; |
| 13540 | break; |
| 13541 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13542 | snd_printd(KERN_WARNING "hda_codec: " |
| 13543 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13544 | return 0; |
| 13545 | } |
| 13546 | if (spec->multiout.dac_nids[0] != dac && |
| 13547 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13548 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13549 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13550 | HDA_OUTPUT)); |
| 13551 | if (err < 0) |
| 13552 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13553 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13554 | } |
| 13555 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13556 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13557 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13558 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13559 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13560 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13561 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13562 | if (err < 0) |
| 13563 | return err; |
| 13564 | return 0; |
| 13565 | } |
| 13566 | |
| 13567 | /* add playback controls from the parsed DAC table */ |
| 13568 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13569 | const struct auto_pin_cfg *cfg) |
| 13570 | { |
| 13571 | hda_nid_t nid; |
| 13572 | int err; |
| 13573 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13574 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13575 | |
| 13576 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13577 | if (nid) { |
| 13578 | const char *name; |
| 13579 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13580 | name = "Speaker"; |
| 13581 | else |
| 13582 | name = "Front"; |
| 13583 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13584 | if (err < 0) |
| 13585 | return err; |
| 13586 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13587 | |
| 13588 | nid = cfg->speaker_pins[0]; |
| 13589 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13590 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13591 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13592 | if (err < 0) |
| 13593 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13594 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13595 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13596 | if (err < 0) |
| 13597 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13598 | } |
| 13599 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13600 | if (nid) { |
| 13601 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13602 | if (err < 0) |
| 13603 | return err; |
| 13604 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13605 | |
| 13606 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13607 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13608 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13609 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13610 | if (err < 0) |
| 13611 | return err; |
| 13612 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13613 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13614 | } |
| 13615 | |
| 13616 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13617 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13618 | const struct auto_pin_cfg *cfg) |
| 13619 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13620 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13621 | } |
| 13622 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13623 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13624 | hda_nid_t nid, int pin_type) |
| 13625 | { |
| 13626 | int idx; |
| 13627 | |
| 13628 | alc_set_pin_output(codec, nid, pin_type); |
| 13629 | if (nid == 0x14 || nid == 0x16) |
| 13630 | idx = 0; |
| 13631 | else |
| 13632 | idx = 1; |
| 13633 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13634 | } |
| 13635 | |
| 13636 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13637 | { |
| 13638 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13639 | int i; |
| 13640 | |
| 13641 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13642 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13643 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13644 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13645 | } |
| 13646 | } |
| 13647 | |
| 13648 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13649 | { |
| 13650 | struct alc_spec *spec = codec->spec; |
| 13651 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13652 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13653 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13654 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13655 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13656 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13657 | } |
| 13658 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13659 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13660 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13661 | } |
| 13662 | if (spec->autocfg.mono_out_pin) |
| 13663 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13664 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13665 | } |
| 13666 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13667 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13668 | { |
| 13669 | struct alc_spec *spec = codec->spec; |
| 13670 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13671 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13672 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13673 | unsigned int dac_vol1, dac_vol2; |
| 13674 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13675 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13676 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13677 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13678 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13679 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13680 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13681 | AMP_IN_UNMUTE(1)); |
| 13682 | snd_hda_codec_write(codec, 0x10, 0, |
| 13683 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13684 | AMP_IN_UNMUTE(1)); |
| 13685 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13686 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13687 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13688 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13689 | snd_hda_codec_write(codec, 0x10, 0, |
| 13690 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13691 | } |
| 13692 | |
| 13693 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13694 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13695 | dac_vol2 = AMP_OUT_ZERO; |
| 13696 | else if (line_nid == 0x15) |
| 13697 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13698 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13699 | dac_vol2 = AMP_OUT_ZERO; |
| 13700 | else if (hp_nid == 0x15) |
| 13701 | dac_vol1 = AMP_OUT_ZERO; |
| 13702 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13703 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13704 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13705 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13706 | |
| 13707 | snd_hda_codec_write(codec, 0x02, 0, |
| 13708 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13709 | snd_hda_codec_write(codec, 0x03, 0, |
| 13710 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13711 | } |
| 13712 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13713 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13714 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13715 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13716 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13717 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13718 | |
| 13719 | /* |
| 13720 | * BIOS auto configuration |
| 13721 | */ |
| 13722 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13723 | { |
| 13724 | struct alc_spec *spec = codec->spec; |
| 13725 | int err; |
| 13726 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13727 | |
| 13728 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13729 | alc268_ignore); |
| 13730 | if (err < 0) |
| 13731 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13732 | if (!spec->autocfg.line_outs) { |
| 13733 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13734 | spec->multiout.max_channels = 2; |
| 13735 | spec->no_analog = 1; |
| 13736 | goto dig_only; |
| 13737 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13738 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13739 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13740 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13741 | if (err < 0) |
| 13742 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13743 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13744 | if (err < 0) |
| 13745 | return err; |
| 13746 | |
| 13747 | spec->multiout.max_channels = 2; |
| 13748 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13749 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13750 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13751 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13752 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13753 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13754 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13755 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13756 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13757 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13758 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13759 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13760 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13761 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13762 | err = alc_auto_add_mic_boost(codec); |
| 13763 | if (err < 0) |
| 13764 | return err; |
| 13765 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13766 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13767 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13768 | return 1; |
| 13769 | } |
| 13770 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13771 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13772 | #define alc268_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13773 | |
| 13774 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13775 | static void alc268_auto_init(struct hda_codec *codec) |
| 13776 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13777 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13778 | alc268_auto_init_multi_out(codec); |
| 13779 | alc268_auto_init_hp_out(codec); |
| 13780 | alc268_auto_init_mono_speaker_out(codec); |
| 13781 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13782 | alc268_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13783 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13784 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13785 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13786 | } |
| 13787 | |
| 13788 | /* |
| 13789 | * configuration and preset |
| 13790 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13791 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13792 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13793 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13794 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13795 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13796 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13797 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13798 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13799 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13800 | #ifdef CONFIG_SND_DEBUG |
| 13801 | [ALC268_TEST] = "test", |
| 13802 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13803 | [ALC268_AUTO] = "auto", |
| 13804 | }; |
| 13805 | |
| 13806 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13807 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13808 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13809 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13810 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13811 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13812 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13813 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13814 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13815 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13816 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13817 | /* almost compatible with toshiba but with optional digital outs; |
| 13818 | * auto-probing seems working fine |
| 13819 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13820 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13821 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13822 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13823 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13824 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13825 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13826 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13827 | {} |
| 13828 | }; |
| 13829 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13830 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13831 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13832 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13833 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13834 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13835 | ALC268_TOSHIBA), |
| 13836 | {} |
| 13837 | }; |
| 13838 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13839 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13840 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13841 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13842 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13843 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13844 | alc267_quanta_il1_verbs }, |
| 13845 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13846 | .dac_nids = alc268_dac_nids, |
| 13847 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13848 | .adc_nids = alc268_adc_nids_alt, |
| 13849 | .hp_nid = 0x03, |
| 13850 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13851 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13852 | .unsol_event = alc_sku_unsol_event, |
| 13853 | .setup = alc267_quanta_il1_setup, |
| 13854 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13855 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13856 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13857 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13858 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13859 | .init_verbs = { alc268_base_init_verbs }, |
| 13860 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13861 | .dac_nids = alc268_dac_nids, |
| 13862 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13863 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13864 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13865 | .hp_nid = 0x03, |
| 13866 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13867 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13868 | .channel_mode = alc268_modes, |
| 13869 | .input_mux = &alc268_capture_source, |
| 13870 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13871 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13872 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13873 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13874 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13875 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13876 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13877 | .dac_nids = alc268_dac_nids, |
| 13878 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13879 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13880 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13881 | .hp_nid = 0x03, |
| 13882 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13883 | .channel_mode = alc268_modes, |
| 13884 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13885 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13886 | .setup = alc268_toshiba_setup, |
| 13887 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13888 | }, |
| 13889 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13890 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13891 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13892 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13893 | alc268_acer_verbs }, |
| 13894 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13895 | .dac_nids = alc268_dac_nids, |
| 13896 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13897 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13898 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13899 | .hp_nid = 0x02, |
| 13900 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13901 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13902 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13903 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13904 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13905 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13906 | [ALC268_ACER_DMIC] = { |
| 13907 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13908 | alc268_beep_mixer }, |
| 13909 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13910 | alc268_acer_verbs }, |
| 13911 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13912 | .dac_nids = alc268_dac_nids, |
| 13913 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13914 | .adc_nids = alc268_adc_nids_alt, |
| 13915 | .capsrc_nids = alc268_capsrc_nids, |
| 13916 | .hp_nid = 0x02, |
| 13917 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13918 | .channel_mode = alc268_modes, |
| 13919 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13920 | .unsol_event = alc268_acer_unsol_event, |
| 13921 | .init_hook = alc268_acer_init_hook, |
| 13922 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13923 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13924 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13925 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13926 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13927 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13928 | alc268_acer_aspire_one_verbs }, |
| 13929 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13930 | .dac_nids = alc268_dac_nids, |
| 13931 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13932 | .adc_nids = alc268_adc_nids_alt, |
| 13933 | .capsrc_nids = alc268_capsrc_nids, |
| 13934 | .hp_nid = 0x03, |
| 13935 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13936 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13937 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13938 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13939 | .init_hook = alc268_acer_lc_init_hook, |
| 13940 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13941 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13942 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13943 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13944 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13945 | alc268_dell_verbs }, |
| 13946 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13947 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13948 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13949 | .adc_nids = alc268_adc_nids_alt, |
| 13950 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13951 | .hp_nid = 0x02, |
| 13952 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13953 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13954 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13955 | .setup = alc268_dell_setup, |
| 13956 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13957 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13958 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13959 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13960 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13961 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13962 | alc268_toshiba_verbs }, |
| 13963 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13964 | .dac_nids = alc268_dac_nids, |
| 13965 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13966 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13967 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13968 | .hp_nid = 0x03, |
| 13969 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13970 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13971 | .channel_mode = alc268_modes, |
| 13972 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13973 | .setup = alc268_toshiba_setup, |
| 13974 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13975 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13976 | #ifdef CONFIG_SND_DEBUG |
| 13977 | [ALC268_TEST] = { |
| 13978 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13979 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13980 | alc268_volume_init_verbs }, |
| 13981 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13982 | .dac_nids = alc268_dac_nids, |
| 13983 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13984 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13985 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13986 | .hp_nid = 0x03, |
| 13987 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13988 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13989 | .channel_mode = alc268_modes, |
| 13990 | .input_mux = &alc268_capture_source, |
| 13991 | }, |
| 13992 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13993 | }; |
| 13994 | |
| 13995 | static int patch_alc268(struct hda_codec *codec) |
| 13996 | { |
| 13997 | struct alc_spec *spec; |
| 13998 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13999 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14000 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 14001 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14002 | if (spec == NULL) |
| 14003 | return -ENOMEM; |
| 14004 | |
| 14005 | codec->spec = spec; |
| 14006 | |
| 14007 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 14008 | alc268_models, |
| 14009 | alc268_cfg_tbl); |
| 14010 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14011 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 14012 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 14013 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14014 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14015 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14016 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14017 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14018 | board_config = ALC268_AUTO; |
| 14019 | } |
| 14020 | |
| 14021 | if (board_config == ALC268_AUTO) { |
| 14022 | /* automatic parse from the BIOS config */ |
| 14023 | err = alc268_parse_auto_config(codec); |
| 14024 | if (err < 0) { |
| 14025 | alc_free(codec); |
| 14026 | return err; |
| 14027 | } else if (!err) { |
| 14028 | printk(KERN_INFO |
| 14029 | "hda_codec: Cannot set up configuration " |
| 14030 | "from BIOS. Using base mode...\n"); |
| 14031 | board_config = ALC268_3ST; |
| 14032 | } |
| 14033 | } |
| 14034 | |
| 14035 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14036 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14037 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14038 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 14039 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 14040 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14041 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14042 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 14043 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14044 | has_beep = 0; |
| 14045 | for (i = 0; i < spec->num_mixers; i++) { |
| 14046 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 14047 | has_beep = 1; |
| 14048 | break; |
| 14049 | } |
| 14050 | } |
| 14051 | |
| 14052 | if (has_beep) { |
| 14053 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14054 | if (err < 0) { |
| 14055 | alc_free(codec); |
| 14056 | return err; |
| 14057 | } |
| 14058 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14059 | /* override the amp caps for beep generator */ |
| 14060 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14061 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14062 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14063 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14064 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14065 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14066 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14067 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14068 | /* check whether NID 0x07 is valid */ |
| 14069 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14070 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14071 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14072 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14073 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14074 | if (spec->auto_mic || |
| 14075 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14076 | spec->adc_nids = alc268_adc_nids_alt; |
| 14077 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14078 | if (spec->auto_mic) |
| 14079 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14080 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14081 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14082 | else |
| 14083 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14084 | } else { |
| 14085 | spec->adc_nids = alc268_adc_nids; |
| 14086 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14087 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14088 | } |
| 14089 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14090 | |
| 14091 | spec->vmaster_nid = 0x02; |
| 14092 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14093 | codec->patch_ops = alc_patch_ops; |
| 14094 | if (board_config == ALC268_AUTO) |
| 14095 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14096 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14097 | alc_init_jacks(codec); |
| 14098 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14099 | return 0; |
| 14100 | } |
| 14101 | |
| 14102 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14103 | * ALC269 channel source setting (2 channel) |
| 14104 | */ |
| 14105 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14106 | |
| 14107 | #define alc269_dac_nids alc260_dac_nids |
| 14108 | |
| 14109 | static hda_nid_t alc269_adc_nids[1] = { |
| 14110 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14111 | 0x08, |
| 14112 | }; |
| 14113 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14114 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14115 | 0x23, |
| 14116 | }; |
| 14117 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14118 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14119 | /* ADC1 */ |
| 14120 | 0x09, |
| 14121 | }; |
| 14122 | |
| 14123 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14124 | 0x22, |
| 14125 | }; |
| 14126 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14127 | static hda_nid_t alc269_adc_candidates[] = { |
David Henningsson | 262ac22 | 2011-04-07 11:43:00 +0200 | [diff] [blame] | 14128 | 0x08, 0x09, 0x07, 0x11, |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14129 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14131 | #define alc269_modes alc260_modes |
| 14132 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14133 | |
| 14134 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14135 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14136 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14137 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14138 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14139 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14140 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14141 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14142 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14143 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14144 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14145 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14146 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14147 | { } /* end */ |
| 14148 | }; |
| 14149 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14150 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14151 | /* output mixer control */ |
| 14152 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14153 | { |
| 14154 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14155 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14156 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14157 | .info = snd_hda_mixer_amp_switch_info, |
| 14158 | .get = snd_hda_mixer_amp_switch_get, |
| 14159 | .put = alc268_acer_master_sw_put, |
| 14160 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14161 | }, |
| 14162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14164 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14165 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14166 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14167 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14168 | { } |
| 14169 | }; |
| 14170 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14171 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14172 | /* output mixer control */ |
| 14173 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14174 | { |
| 14175 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14176 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14177 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14178 | .info = snd_hda_mixer_amp_switch_info, |
| 14179 | .get = snd_hda_mixer_amp_switch_get, |
| 14180 | .put = alc268_acer_master_sw_put, |
| 14181 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14182 | }, |
| 14183 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14184 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14185 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14186 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14187 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14188 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14189 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14190 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14191 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14192 | { } |
| 14193 | }; |
| 14194 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14195 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14196 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14197 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14198 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14199 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14200 | { } /* end */ |
| 14201 | }; |
| 14202 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14203 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14204 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14205 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14206 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14207 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14208 | { } /* end */ |
| 14209 | }; |
| 14210 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14211 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14212 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14213 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14214 | { } /* end */ |
| 14215 | }; |
| 14216 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14217 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14218 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14219 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14220 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14221 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14222 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14223 | { } /* end */ |
| 14224 | }; |
| 14225 | |
| 14226 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14227 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14228 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14229 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14230 | { } /* end */ |
| 14231 | }; |
| 14232 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14233 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14234 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14235 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14236 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14237 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14238 | { } /* end */ |
| 14239 | }; |
| 14240 | |
| 14241 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14242 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14243 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14244 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14245 | { } /* end */ |
| 14246 | }; |
| 14247 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14248 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14249 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14250 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14251 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14252 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14253 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14254 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14255 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14256 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14257 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14258 | { } |
| 14259 | }; |
| 14260 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14261 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14262 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14263 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14264 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14265 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14266 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14267 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14268 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14269 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14270 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14271 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14272 | { } |
| 14273 | }; |
| 14274 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14275 | /* toggle speaker-output according to the hp-jack state */ |
| 14276 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14277 | { |
| 14278 | unsigned int present; |
| 14279 | unsigned char bits; |
| 14280 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14281 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14282 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14283 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14284 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14285 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14286 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14287 | |
| 14288 | snd_hda_codec_write(codec, 0x20, 0, |
| 14289 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14290 | snd_hda_codec_write(codec, 0x20, 0, |
| 14291 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14292 | |
| 14293 | snd_hda_codec_write(codec, 0x20, 0, |
| 14294 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14295 | snd_hda_codec_write(codec, 0x20, 0, |
| 14296 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14297 | } |
| 14298 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14299 | /* toggle speaker-output according to the hp-jacks state */ |
| 14300 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14301 | { |
| 14302 | unsigned int present; |
| 14303 | unsigned char bits; |
| 14304 | |
| 14305 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14306 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14307 | |
| 14308 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14309 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14310 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14311 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14312 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14313 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14314 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14315 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14316 | |
| 14317 | snd_hda_codec_write(codec, 0x20, 0, |
| 14318 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14319 | snd_hda_codec_write(codec, 0x20, 0, |
| 14320 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14321 | |
| 14322 | snd_hda_codec_write(codec, 0x20, 0, |
| 14323 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14324 | snd_hda_codec_write(codec, 0x20, 0, |
| 14325 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14326 | } |
| 14327 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14328 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14329 | { |
| 14330 | unsigned int present_laptop; |
| 14331 | unsigned int present_dock; |
| 14332 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14333 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14334 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14335 | |
| 14336 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14337 | if (present_dock) |
| 14338 | snd_hda_codec_write(codec, 0x23, 0, |
| 14339 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14340 | if (present_laptop) |
| 14341 | snd_hda_codec_write(codec, 0x23, 0, |
| 14342 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14343 | if (!present_dock && !present_laptop) |
| 14344 | snd_hda_codec_write(codec, 0x23, 0, |
| 14345 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14346 | } |
| 14347 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14348 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14349 | unsigned int res) |
| 14350 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14351 | switch (res >> 26) { |
| 14352 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14353 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14354 | break; |
| 14355 | case ALC880_MIC_EVENT: |
| 14356 | alc_mic_automute(codec); |
| 14357 | break; |
| 14358 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14359 | } |
| 14360 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14361 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14362 | unsigned int res) |
| 14363 | { |
| 14364 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14365 | alc269_lifebook_speaker_automute(codec); |
| 14366 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14367 | alc269_lifebook_mic_autoswitch(codec); |
| 14368 | } |
| 14369 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14370 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14371 | { |
| 14372 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14373 | spec->autocfg.hp_pins[0] = 0x15; |
| 14374 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14375 | spec->ext_mic.pin = 0x18; |
| 14376 | spec->ext_mic.mux_idx = 0; |
| 14377 | spec->int_mic.pin = 0x19; |
| 14378 | spec->int_mic.mux_idx = 1; |
| 14379 | spec->auto_mic = 1; |
| 14380 | } |
| 14381 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14382 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14383 | { |
| 14384 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14385 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14386 | } |
| 14387 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14388 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14389 | { |
| 14390 | alc269_lifebook_speaker_automute(codec); |
| 14391 | alc269_lifebook_mic_autoswitch(codec); |
| 14392 | } |
| 14393 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14394 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14395 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14396 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14397 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14398 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14399 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14400 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14401 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14402 | {} |
| 14403 | }; |
| 14404 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14405 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14406 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14407 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14408 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14409 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14410 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14411 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14412 | {} |
| 14413 | }; |
| 14414 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14415 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14416 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14417 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14418 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14420 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14421 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14422 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14423 | {} |
| 14424 | }; |
| 14425 | |
| 14426 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14427 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14428 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14429 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14430 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14431 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14432 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14433 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14434 | {} |
| 14435 | }; |
| 14436 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14437 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14438 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14439 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14440 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14441 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14442 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14443 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14444 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14445 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14446 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14447 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14448 | { } |
| 14449 | }; |
| 14450 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14451 | /* toggle speaker-output according to the hp-jack state */ |
| 14452 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14453 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14454 | struct alc_spec *spec = codec->spec; |
| 14455 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14456 | unsigned int present; |
| 14457 | unsigned char bits; |
| 14458 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14459 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14460 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14461 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14462 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14463 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14464 | HDA_AMP_MUTE, bits); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 14465 | snd_hda_input_jack_report(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14466 | } |
| 14467 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14468 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14469 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14470 | unsigned int res) |
| 14471 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14472 | switch (res >> 26) { |
| 14473 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14474 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14475 | break; |
| 14476 | case ALC880_MIC_EVENT: |
| 14477 | alc_mic_automute(codec); |
| 14478 | break; |
| 14479 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14480 | } |
| 14481 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14482 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14483 | { |
| 14484 | struct alc_spec *spec = codec->spec; |
| 14485 | spec->autocfg.hp_pins[0] = 0x15; |
| 14486 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14487 | spec->ext_mic.pin = 0x18; |
| 14488 | spec->ext_mic.mux_idx = 0; |
| 14489 | spec->int_mic.pin = 0x19; |
| 14490 | spec->int_mic.mux_idx = 1; |
| 14491 | spec->auto_mic = 1; |
| 14492 | } |
| 14493 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14494 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14495 | { |
| 14496 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14497 | spec->autocfg.hp_pins[0] = 0x15; |
| 14498 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14499 | spec->ext_mic.pin = 0x18; |
| 14500 | spec->ext_mic.mux_idx = 0; |
| 14501 | spec->int_mic.pin = 0x12; |
| 14502 | spec->int_mic.mux_idx = 5; |
| 14503 | spec->auto_mic = 1; |
| 14504 | } |
| 14505 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14506 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14507 | { |
| 14508 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14509 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14510 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14511 | spec->ext_mic.pin = 0x18; |
| 14512 | spec->ext_mic.mux_idx = 0; |
| 14513 | spec->int_mic.pin = 0x19; |
| 14514 | spec->int_mic.mux_idx = 1; |
| 14515 | spec->auto_mic = 1; |
| 14516 | } |
| 14517 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14518 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14519 | { |
| 14520 | struct alc_spec *spec = codec->spec; |
| 14521 | spec->autocfg.hp_pins[0] = 0x21; |
| 14522 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14523 | spec->ext_mic.pin = 0x18; |
| 14524 | spec->ext_mic.mux_idx = 0; |
| 14525 | spec->int_mic.pin = 0x12; |
| 14526 | spec->int_mic.mux_idx = 6; |
| 14527 | spec->auto_mic = 1; |
| 14528 | } |
| 14529 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14530 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14531 | { |
| 14532 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14533 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14534 | } |
| 14535 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14536 | /* |
| 14537 | * generic initialization of ADC, input mixers and output mixers |
| 14538 | */ |
| 14539 | static struct hda_verb alc269_init_verbs[] = { |
| 14540 | /* |
| 14541 | * Unmute ADC0 and set the default input to mic-in |
| 14542 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14543 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14544 | |
| 14545 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14546 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14547 | */ |
| 14548 | /* set vol=0 to output mixers */ |
| 14549 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14550 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14551 | |
| 14552 | /* set up input amps for analog loopback */ |
| 14553 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14554 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14555 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14556 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14557 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14558 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14559 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14560 | |
| 14561 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14562 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14563 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14564 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14565 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14566 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14567 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14568 | |
| 14569 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14570 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14571 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14572 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14573 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14574 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14575 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14576 | |
| 14577 | /* set EAPD */ |
| 14578 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14579 | { } |
| 14580 | }; |
| 14581 | |
| 14582 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14583 | /* |
| 14584 | * Unmute ADC0 and set the default input to mic-in |
| 14585 | */ |
| 14586 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14587 | |
| 14588 | /* |
| 14589 | * Set up output mixers (0x02 - 0x03) |
| 14590 | */ |
| 14591 | /* set vol=0 to output mixers */ |
| 14592 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14593 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14594 | |
| 14595 | /* set up input amps for analog loopback */ |
| 14596 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14597 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14600 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14601 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14602 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14603 | |
| 14604 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14605 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14606 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14607 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14608 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14609 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14610 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14611 | |
| 14612 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14613 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14614 | |
| 14615 | /* FIXME: use Mux-type input source selection */ |
| 14616 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14617 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14618 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14619 | |
| 14620 | /* set EAPD */ |
| 14621 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14622 | { } |
| 14623 | }; |
| 14624 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14625 | #define alc269_auto_create_multi_out_ctls \ |
| 14626 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14627 | #define alc269_auto_create_input_ctls \ |
| 14628 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14629 | |
| 14630 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14631 | #define alc269_loopbacks alc880_loopbacks |
| 14632 | #endif |
| 14633 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14634 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14635 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14636 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14637 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14638 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14639 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14640 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14641 | .substreams = 1, |
| 14642 | .channels_min = 2, |
| 14643 | .channels_max = 8, |
| 14644 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14645 | /* NID is set in alc_build_pcms */ |
| 14646 | .ops = { |
| 14647 | .open = alc880_playback_pcm_open, |
| 14648 | .prepare = alc880_playback_pcm_prepare, |
| 14649 | .cleanup = alc880_playback_pcm_cleanup |
| 14650 | }, |
| 14651 | }; |
| 14652 | |
| 14653 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14654 | .substreams = 1, |
| 14655 | .channels_min = 2, |
| 14656 | .channels_max = 2, |
| 14657 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14658 | /* NID is set in alc_build_pcms */ |
| 14659 | }; |
| 14660 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14661 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14662 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14663 | { |
| 14664 | switch (codec->subsystem_id) { |
| 14665 | case 0x103c1586: |
| 14666 | return 1; |
| 14667 | } |
| 14668 | return 0; |
| 14669 | } |
| 14670 | |
| 14671 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14672 | { |
| 14673 | /* update mute-LED according to the speaker mute state */ |
| 14674 | if (nid == 0x01 || nid == 0x14) { |
| 14675 | int pinval; |
| 14676 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14677 | HDA_AMP_MUTE) |
| 14678 | pinval = 0x24; |
| 14679 | else |
| 14680 | pinval = 0x20; |
| 14681 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a5 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14682 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14683 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14684 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14685 | } |
| 14686 | return alc_check_power_status(codec, nid); |
| 14687 | } |
| 14688 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14689 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14690 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14691 | { |
| 14692 | struct alc_spec *spec = codec->spec; |
| 14693 | |
| 14694 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14695 | return 0; |
| 14696 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14697 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14698 | if (spec->ext_mic.pin <= 0x12) { |
| 14699 | spec->private_adc_nids[0] = 0x08; |
| 14700 | spec->private_adc_nids[1] = 0x11; |
| 14701 | spec->private_capsrc_nids[0] = 0x23; |
| 14702 | spec->private_capsrc_nids[1] = 0x22; |
| 14703 | } else { |
| 14704 | spec->private_adc_nids[0] = 0x11; |
| 14705 | spec->private_adc_nids[1] = 0x08; |
| 14706 | spec->private_capsrc_nids[0] = 0x22; |
| 14707 | spec->private_capsrc_nids[1] = 0x23; |
| 14708 | } |
| 14709 | spec->adc_nids = spec->private_adc_nids; |
| 14710 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14711 | spec->num_adc_nids = 2; |
| 14712 | spec->dual_adc_switch = 1; |
| 14713 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14714 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14715 | return 1; |
| 14716 | } |
| 14717 | return 0; |
| 14718 | } |
| 14719 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14720 | /* different alc269-variants */ |
| 14721 | enum { |
| 14722 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14723 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14724 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14725 | ALC269_TYPE_ALC269VB, |
| 14726 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14727 | ALC269_TYPE_ALC271X, |
| 14728 | }; |
| 14729 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14730 | /* |
| 14731 | * BIOS auto configuration |
| 14732 | */ |
| 14733 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14734 | { |
| 14735 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14736 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14737 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14738 | |
| 14739 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14740 | alc269_ignore); |
| 14741 | if (err < 0) |
| 14742 | return err; |
| 14743 | |
| 14744 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14745 | if (err < 0) |
| 14746 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14747 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14748 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14749 | else |
| 14750 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14751 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14752 | if (err < 0) |
| 14753 | return err; |
| 14754 | |
| 14755 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14756 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14757 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14758 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14759 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14760 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14761 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14762 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14763 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14764 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14765 | } else { |
| 14766 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14767 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14768 | } |
| 14769 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14770 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14771 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14772 | |
| 14773 | if (!alc275_setup_dual_adc(codec)) |
| 14774 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14775 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14776 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14777 | err = alc_auto_add_mic_boost(codec); |
| 14778 | if (err < 0) |
| 14779 | return err; |
| 14780 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14781 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14782 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14783 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14784 | return 1; |
| 14785 | } |
| 14786 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14787 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14788 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14789 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14790 | #define alc269_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14791 | |
| 14792 | |
| 14793 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14794 | static void alc269_auto_init(struct hda_codec *codec) |
| 14795 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14796 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14797 | alc269_auto_init_multi_out(codec); |
| 14798 | alc269_auto_init_hp_out(codec); |
| 14799 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14800 | if (!spec->dual_adc_switch) |
| 14801 | alc269_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14802 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14803 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14804 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14805 | } |
| 14806 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14807 | #ifdef SND_HDA_NEEDS_RESUME |
| 14808 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14809 | { |
| 14810 | int val = alc_read_coef_idx(codec, 0x04); |
| 14811 | if (power_up) |
| 14812 | val |= 1 << 11; |
| 14813 | else |
| 14814 | val &= ~(1 << 11); |
| 14815 | alc_write_coef_idx(codec, 0x04, val); |
| 14816 | } |
| 14817 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14818 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14819 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14820 | { |
| 14821 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14822 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14823 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14824 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14825 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14826 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14827 | msleep(150); |
| 14828 | } |
| 14829 | |
| 14830 | alc_shutup(codec); |
| 14831 | if (spec && spec->power_hook) |
| 14832 | spec->power_hook(codec); |
| 14833 | return 0; |
| 14834 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14835 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14836 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14837 | static int alc269_resume(struct hda_codec *codec) |
| 14838 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14839 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14840 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14841 | msleep(150); |
| 14842 | } |
| 14843 | |
| 14844 | codec->patch_ops.init(codec); |
| 14845 | |
| 14846 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14847 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14848 | msleep(200); |
| 14849 | } |
| 14850 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14851 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14852 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14853 | |
| 14854 | snd_hda_codec_resume_amp(codec); |
| 14855 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14856 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14857 | return 0; |
| 14858 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14859 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14860 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14861 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14862 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14863 | { |
| 14864 | int coef; |
| 14865 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14866 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14867 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14868 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14869 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14870 | } |
| 14871 | |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14872 | static void alc271_fixup_dmic(struct hda_codec *codec, |
| 14873 | const struct alc_fixup *fix, int action) |
| 14874 | { |
| 14875 | static struct hda_verb verbs[] = { |
| 14876 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14877 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14878 | {} |
| 14879 | }; |
| 14880 | unsigned int cfg; |
| 14881 | |
| 14882 | if (strcmp(codec->chip_name, "ALC271X")) |
| 14883 | return; |
| 14884 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); |
| 14885 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) |
| 14886 | snd_hda_sequence_write(codec, verbs); |
| 14887 | } |
| 14888 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14889 | enum { |
| 14890 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14891 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14892 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14893 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14894 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14895 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14896 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14897 | ALC271_FIXUP_DMIC, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14898 | }; |
| 14899 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14900 | static const struct alc_fixup alc269_fixups[] = { |
| 14901 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14902 | .type = ALC_FIXUP_VERBS, |
| 14903 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14904 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14905 | {} |
| 14906 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14907 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14908 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14909 | .type = ALC_FIXUP_VERBS, |
| 14910 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14911 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14912 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14913 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14914 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14915 | }, |
| 14916 | .chained = true, |
| 14917 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14918 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14919 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14920 | .type = ALC_FIXUP_VERBS, |
| 14921 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14922 | /* Enables internal speaker */ |
| 14923 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14924 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14925 | {} |
| 14926 | } |
| 14927 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14928 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14929 | .type = ALC_FIXUP_SKU, |
| 14930 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14931 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14932 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14933 | .type = ALC_FIXUP_PINS, |
| 14934 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14935 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14936 | { } |
| 14937 | } |
| 14938 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14939 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14940 | .type = ALC_FIXUP_VERBS, |
| 14941 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14942 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14943 | {} |
| 14944 | } |
| 14945 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14946 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14947 | .type = ALC_FIXUP_FUNC, |
| 14948 | .v.func = alc269_fixup_hweq, |
| 14949 | .chained = true, |
| 14950 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14951 | }, |
| 14952 | [ALC271_FIXUP_DMIC] = { |
| 14953 | .type = ALC_FIXUP_FUNC, |
| 14954 | .v.func = alc271_fixup_dmic, |
| 14955 | }, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14956 | }; |
| 14957 | |
| 14958 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14959 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14960 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14961 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14962 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14963 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14964 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14965 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14966 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14967 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14968 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14969 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14970 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14971 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14972 | {} |
| 14973 | }; |
| 14974 | |
| 14975 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14976 | /* |
| 14977 | * configuration and preset |
| 14978 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14979 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14980 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14981 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14982 | [ALC269_AMIC] = "laptop-amic", |
| 14983 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14984 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14985 | [ALC269_LIFEBOOK] = "lifebook", |
| 14986 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14987 | }; |
| 14988 | |
| 14989 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14990 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14991 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14992 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14993 | ALC269_AMIC), |
| 14994 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14995 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14996 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14997 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14998 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14999 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 15000 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 15001 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 15002 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
Chih-Wei Huang | c790ad3 | 2011-02-25 11:14:31 +0800 | [diff] [blame] | 15003 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15004 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 15005 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 15006 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 15007 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 15008 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 15009 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 15010 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 15011 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 15012 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 15013 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 15014 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 15015 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 15016 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 15017 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 15018 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 15019 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 15020 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 15021 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 15022 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 15023 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 15024 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 15025 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 15026 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 15027 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 15028 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 15029 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15030 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15031 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15032 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15033 | ALC269_DMIC), |
| 15034 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 15035 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15036 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15037 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 15038 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 15039 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 15040 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 15041 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 15042 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 15043 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15044 | {} |
| 15045 | }; |
| 15046 | |
| 15047 | static struct alc_config_preset alc269_presets[] = { |
| 15048 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15049 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15050 | .init_verbs = { alc269_init_verbs }, |
| 15051 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15052 | .dac_nids = alc269_dac_nids, |
| 15053 | .hp_nid = 0x03, |
| 15054 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15055 | .channel_mode = alc269_modes, |
| 15056 | .input_mux = &alc269_capture_source, |
| 15057 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15058 | [ALC269_QUANTA_FL1] = { |
| 15059 | .mixers = { alc269_quanta_fl1_mixer }, |
| 15060 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 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, |
| 15066 | .input_mux = &alc269_capture_source, |
| 15067 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15068 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15069 | .init_hook = alc269_quanta_fl1_init_hook, |
| 15070 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15071 | [ALC269_AMIC] = { |
| 15072 | .mixers = { alc269_laptop_mixer }, |
| 15073 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15074 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15075 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15076 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15077 | .dac_nids = alc269_dac_nids, |
| 15078 | .hp_nid = 0x03, |
| 15079 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15080 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15081 | .unsol_event = alc269_laptop_unsol_event, |
| 15082 | .setup = alc269_laptop_amic_setup, |
| 15083 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15084 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15085 | [ALC269_DMIC] = { |
| 15086 | .mixers = { alc269_laptop_mixer }, |
| 15087 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15088 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15089 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15090 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15091 | .dac_nids = alc269_dac_nids, |
| 15092 | .hp_nid = 0x03, |
| 15093 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15094 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15095 | .unsol_event = alc269_laptop_unsol_event, |
| 15096 | .setup = alc269_laptop_dmic_setup, |
| 15097 | .init_hook = alc269_laptop_inithook, |
| 15098 | }, |
| 15099 | [ALC269VB_AMIC] = { |
| 15100 | .mixers = { alc269vb_laptop_mixer }, |
| 15101 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15102 | .init_verbs = { alc269vb_init_verbs, |
| 15103 | alc269vb_laptop_amic_init_verbs }, |
| 15104 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15105 | .dac_nids = alc269_dac_nids, |
| 15106 | .hp_nid = 0x03, |
| 15107 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15108 | .channel_mode = alc269_modes, |
| 15109 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15110 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15111 | .init_hook = alc269_laptop_inithook, |
| 15112 | }, |
| 15113 | [ALC269VB_DMIC] = { |
| 15114 | .mixers = { alc269vb_laptop_mixer }, |
| 15115 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15116 | .init_verbs = { alc269vb_init_verbs, |
| 15117 | alc269vb_laptop_dmic_init_verbs }, |
| 15118 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15119 | .dac_nids = alc269_dac_nids, |
| 15120 | .hp_nid = 0x03, |
| 15121 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15122 | .channel_mode = alc269_modes, |
| 15123 | .unsol_event = alc269_laptop_unsol_event, |
| 15124 | .setup = alc269vb_laptop_dmic_setup, |
| 15125 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15126 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15127 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15128 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15129 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15130 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15131 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15132 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15133 | .dac_nids = alc269_dac_nids, |
| 15134 | .hp_nid = 0x03, |
| 15135 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15136 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15137 | .unsol_event = alc269_laptop_unsol_event, |
| 15138 | .setup = alc269_laptop_dmic_setup, |
| 15139 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15140 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15141 | [ALC269_LIFEBOOK] = { |
| 15142 | .mixers = { alc269_lifebook_mixer }, |
| 15143 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15144 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15145 | .dac_nids = alc269_dac_nids, |
| 15146 | .hp_nid = 0x03, |
| 15147 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15148 | .channel_mode = alc269_modes, |
| 15149 | .input_mux = &alc269_capture_source, |
| 15150 | .unsol_event = alc269_lifebook_unsol_event, |
| 15151 | .init_hook = alc269_lifebook_init_hook, |
| 15152 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15153 | [ALC271_ACER] = { |
| 15154 | .mixers = { alc269_asus_mixer }, |
| 15155 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15156 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15157 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15158 | .dac_nids = alc269_dac_nids, |
| 15159 | .adc_nids = alc262_dmic_adc_nids, |
| 15160 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15161 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15162 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15163 | .channel_mode = alc269_modes, |
| 15164 | .input_mux = &alc269_capture_source, |
| 15165 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15166 | .unsol_event = alc_sku_unsol_event, |
| 15167 | .setup = alc269vb_laptop_dmic_setup, |
| 15168 | .init_hook = alc_inithook, |
| 15169 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15170 | }; |
| 15171 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15172 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15173 | { |
| 15174 | int val; |
| 15175 | |
| 15176 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15177 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15178 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15179 | } |
| 15180 | |
| 15181 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15182 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15183 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15184 | } |
| 15185 | |
| 15186 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15187 | val = alc_read_coef_idx(codec, 0x04); |
| 15188 | /* Power up output pin */ |
| 15189 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15190 | } |
| 15191 | |
| 15192 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15193 | val = alc_read_coef_idx(codec, 0xd); |
| 15194 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15195 | /* Capless ramp up clock control */ |
| 15196 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15197 | } |
| 15198 | val = alc_read_coef_idx(codec, 0x17); |
| 15199 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15200 | /* Class D power on reset */ |
| 15201 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15202 | } |
| 15203 | } |
| 15204 | return 0; |
| 15205 | } |
| 15206 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15207 | static int patch_alc269(struct hda_codec *codec) |
| 15208 | { |
| 15209 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15210 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15211 | int err; |
| 15212 | |
| 15213 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15214 | if (spec == NULL) |
| 15215 | return -ENOMEM; |
| 15216 | |
| 15217 | codec->spec = spec; |
| 15218 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15219 | alc_auto_parse_customize_define(codec); |
| 15220 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15221 | if (codec->vendor_id == 0x10ec0269) { |
| 15222 | coef = alc_read_coef_idx(codec, 0); |
| 15223 | if ((coef & 0x00f0) == 0x0010) { |
| 15224 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15225 | spec->cdefine.platform_type == 1) { |
| 15226 | alc_codec_rename(codec, "ALC271X"); |
| 15227 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15228 | } else if ((coef & 0xf000) == 0x1000) { |
| 15229 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15230 | } else if ((coef & 0xf000) == 0x2000) { |
| 15231 | alc_codec_rename(codec, "ALC259"); |
| 15232 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15233 | } else if ((coef & 0xf000) == 0x3000) { |
| 15234 | alc_codec_rename(codec, "ALC258"); |
| 15235 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15236 | } else { |
| 15237 | alc_codec_rename(codec, "ALC269VB"); |
| 15238 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15239 | } |
| 15240 | } else |
| 15241 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15242 | alc269_fill_coef(codec); |
| 15243 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15244 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15245 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15246 | alc269_models, |
| 15247 | alc269_cfg_tbl); |
| 15248 | |
| 15249 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15250 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15251 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15252 | board_config = ALC269_AUTO; |
| 15253 | } |
| 15254 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15255 | if (board_config == ALC269_AUTO) { |
| 15256 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15257 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15258 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15259 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15260 | if (board_config == ALC269_AUTO) { |
| 15261 | /* automatic parse from the BIOS config */ |
| 15262 | err = alc269_parse_auto_config(codec); |
| 15263 | if (err < 0) { |
| 15264 | alc_free(codec); |
| 15265 | return err; |
| 15266 | } else if (!err) { |
| 15267 | printk(KERN_INFO |
| 15268 | "hda_codec: Cannot set up configuration " |
| 15269 | "from BIOS. Using base mode...\n"); |
| 15270 | board_config = ALC269_BASIC; |
| 15271 | } |
| 15272 | } |
| 15273 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15274 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15275 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15276 | if (err < 0) { |
| 15277 | alc_free(codec); |
| 15278 | return err; |
| 15279 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15280 | } |
| 15281 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15282 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15283 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15284 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15285 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15286 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15287 | * fix the sample rate of analog I/O to 44.1kHz |
| 15288 | */ |
| 15289 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15290 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15291 | } else if (spec->dual_adc_switch) { |
| 15292 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15293 | /* switch ADC dynamically */ |
| 15294 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15295 | } else { |
| 15296 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15297 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15298 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15299 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15300 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15301 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15302 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15303 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15304 | spec->adc_nids = alc269_adc_nids; |
| 15305 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15306 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15307 | } else { |
| 15308 | spec->adc_nids = alc269vb_adc_nids; |
| 15309 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15310 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15311 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15312 | } |
| 15313 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15314 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15315 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15316 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15317 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15318 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15319 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15320 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15321 | spec->vmaster_nid = 0x02; |
| 15322 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15323 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15324 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15325 | codec->patch_ops.suspend = alc269_suspend; |
| 15326 | #endif |
| 15327 | #ifdef SND_HDA_NEEDS_RESUME |
| 15328 | codec->patch_ops.resume = alc269_resume; |
| 15329 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15330 | if (board_config == ALC269_AUTO) |
| 15331 | spec->init_hook = alc269_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15332 | |
| 15333 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15334 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15335 | if (!spec->loopback.amplist) |
| 15336 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15337 | if (alc269_mic2_for_mute_led(codec)) |
| 15338 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15339 | #endif |
| 15340 | |
| 15341 | return 0; |
| 15342 | } |
| 15343 | |
| 15344 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15345 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15346 | */ |
| 15347 | |
| 15348 | /* |
| 15349 | * set the path ways for 2 channel output |
| 15350 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15351 | */ |
| 15352 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15353 | /* set pin widget 1Ah (line in) for input */ |
| 15354 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15355 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15356 | * the vref |
| 15357 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15358 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15359 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15360 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15361 | #if 0 |
| 15362 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15363 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15364 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15365 | { } /* end */ |
| 15366 | }; |
| 15367 | /* |
| 15368 | * 6ch mode |
| 15369 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15370 | */ |
| 15371 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15372 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15373 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15374 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15375 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15376 | |
| 15377 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15378 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15379 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15380 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15381 | #if 0 |
| 15382 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15383 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15384 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15385 | { } /* end */ |
| 15386 | }; |
| 15387 | |
| 15388 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15389 | { 2, alc861_threestack_ch2_init }, |
| 15390 | { 6, alc861_threestack_ch6_init }, |
| 15391 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15392 | /* Set mic1 as input and unmute the mixer */ |
| 15393 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15394 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15395 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15396 | { } /* end */ |
| 15397 | }; |
| 15398 | /* Set mic1 as output and mute mixer */ |
| 15399 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15400 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15401 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15402 | { } /* end */ |
| 15403 | }; |
| 15404 | |
| 15405 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15406 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15407 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15408 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15409 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15410 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15411 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15412 | /* set pin widget 1Ah (line in) for input */ |
| 15413 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15414 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15415 | * the vref |
| 15416 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15417 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15418 | |
| 15419 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15420 | #if 0 |
| 15421 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15422 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15423 | #endif |
| 15424 | { } /* end */ |
| 15425 | }; |
| 15426 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15427 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15428 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15429 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15430 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15431 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15432 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15433 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15434 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15435 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15436 | |
| 15437 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15438 | #if 0 |
| 15439 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15440 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15441 | #endif |
| 15442 | { } /* end */ |
| 15443 | }; |
| 15444 | |
| 15445 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15446 | { 2, alc861_asus_ch2_init }, |
| 15447 | { 6, alc861_asus_ch6_init }, |
| 15448 | }; |
| 15449 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15450 | /* patch-ALC861 */ |
| 15451 | |
| 15452 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15453 | /* output mixer control */ |
| 15454 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15455 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15456 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15457 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15458 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15459 | |
| 15460 | /*Input mixer control */ |
| 15461 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15462 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15463 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15464 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15465 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15466 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15469 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15470 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15471 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15472 | { } /* end */ |
| 15473 | }; |
| 15474 | |
| 15475 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15476 | /* output mixer control */ |
| 15477 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15478 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15479 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15480 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15481 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15482 | |
| 15483 | /* Input mixer control */ |
| 15484 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15485 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15486 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15487 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15488 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15489 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15490 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15491 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15492 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15493 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15494 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15495 | { |
| 15496 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15497 | .name = "Channel Mode", |
| 15498 | .info = alc_ch_mode_info, |
| 15499 | .get = alc_ch_mode_get, |
| 15500 | .put = alc_ch_mode_put, |
| 15501 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15502 | }, |
| 15503 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15504 | }; |
| 15505 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15506 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15507 | /* output mixer control */ |
| 15508 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15509 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15510 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15511 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15512 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15513 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15514 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15515 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15516 | /* output mixer control */ |
| 15517 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15518 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15519 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15520 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15521 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15522 | |
| 15523 | /* Input mixer control */ |
| 15524 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15525 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15526 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15527 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15528 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15529 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15530 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15531 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15532 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15533 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15534 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15535 | { |
| 15536 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15537 | .name = "Channel Mode", |
| 15538 | .info = alc_ch_mode_info, |
| 15539 | .get = alc_ch_mode_get, |
| 15540 | .put = alc_ch_mode_put, |
| 15541 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15542 | }, |
| 15543 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15544 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15545 | |
| 15546 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15547 | /* output mixer control */ |
| 15548 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15549 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15550 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15551 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15552 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15553 | |
| 15554 | /* Input mixer control */ |
| 15555 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15556 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15557 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15558 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15559 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15560 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15561 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15562 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15563 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15564 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15565 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15566 | { |
| 15567 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15568 | .name = "Channel Mode", |
| 15569 | .info = alc_ch_mode_info, |
| 15570 | .get = alc_ch_mode_get, |
| 15571 | .put = alc_ch_mode_put, |
| 15572 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15573 | }, |
| 15574 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15575 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15576 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15577 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15578 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15579 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15580 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15581 | { } |
| 15582 | }; |
| 15583 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15584 | /* |
| 15585 | * generic initialization of ADC, input mixers and output mixers |
| 15586 | */ |
| 15587 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15588 | /* |
| 15589 | * Unmute ADC0 and set the default input to mic-in |
| 15590 | */ |
| 15591 | /* port-A for surround (rear panel) */ |
| 15592 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15593 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15594 | /* port-B for mic-in (rear panel) with vref */ |
| 15595 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15596 | /* port-C for line-in (rear panel) */ |
| 15597 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15598 | /* port-D for Front */ |
| 15599 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15600 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15601 | /* port-E for HP out (front panel) */ |
| 15602 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15603 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15604 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15605 | /* port-F for mic-in (front panel) with vref */ |
| 15606 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15607 | /* port-G for CLFE (rear panel) */ |
| 15608 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15609 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15610 | /* port-H for side (rear panel) */ |
| 15611 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15612 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15613 | /* CD-in */ |
| 15614 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15615 | /* route front mic to ADC1*/ |
| 15616 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15617 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15619 | /* Unmute DAC0~3 & spdif out*/ |
| 15620 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15621 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15622 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15623 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15624 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15625 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15626 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15627 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15628 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15629 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15630 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15631 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15632 | /* Unmute Stereo Mixer 15 */ |
| 15633 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15634 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15635 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15636 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15637 | |
| 15638 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15639 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15640 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15641 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15642 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15643 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15644 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15645 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15646 | /* hp used DAC 3 (Front) */ |
| 15647 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15648 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15649 | |
| 15650 | { } |
| 15651 | }; |
| 15652 | |
| 15653 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15654 | /* |
| 15655 | * Unmute ADC0 and set the default input to mic-in |
| 15656 | */ |
| 15657 | /* port-A for surround (rear panel) */ |
| 15658 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15659 | /* port-B for mic-in (rear panel) with vref */ |
| 15660 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15661 | /* port-C for line-in (rear panel) */ |
| 15662 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15663 | /* port-D for Front */ |
| 15664 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15665 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15666 | /* port-E for HP out (front panel) */ |
| 15667 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15668 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15669 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15670 | /* port-F for mic-in (front panel) with vref */ |
| 15671 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15672 | /* port-G for CLFE (rear panel) */ |
| 15673 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15674 | /* port-H for side (rear panel) */ |
| 15675 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15676 | /* CD-in */ |
| 15677 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15678 | /* route front mic to ADC1*/ |
| 15679 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15680 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15681 | /* Unmute DAC0~3 & spdif out*/ |
| 15682 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15683 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15684 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15685 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15686 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15687 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15688 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15689 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15690 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15691 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15692 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15693 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15694 | /* Unmute Stereo Mixer 15 */ |
| 15695 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15696 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15697 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15698 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15699 | |
| 15700 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15701 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15702 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15703 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15704 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15705 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15706 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15707 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15708 | /* hp used DAC 3 (Front) */ |
| 15709 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15710 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15711 | { } |
| 15712 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15713 | |
| 15714 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15715 | /* |
| 15716 | * Unmute ADC0 and set the default input to mic-in |
| 15717 | */ |
| 15718 | /* port-A for surround (rear panel) */ |
| 15719 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15720 | /* port-B for mic-in (rear panel) with vref */ |
| 15721 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15722 | /* port-C for line-in (rear panel) */ |
| 15723 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15724 | /* port-D for Front */ |
| 15725 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15726 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15727 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15728 | /* this has to be set to VREF80 */ |
| 15729 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15730 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15731 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15732 | /* port-F for mic-in (front panel) with vref */ |
| 15733 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15734 | /* port-G for CLFE (rear panel) */ |
| 15735 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15736 | /* port-H for side (rear panel) */ |
| 15737 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15738 | /* CD-in */ |
| 15739 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15740 | /* route front mic to ADC1*/ |
| 15741 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15742 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15743 | /* Unmute DAC0~3 & spdif out*/ |
| 15744 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15745 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15746 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15747 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15748 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15749 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15750 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15751 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15752 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15753 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15754 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15755 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15756 | /* Unmute Stereo Mixer 15 */ |
| 15757 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15758 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15759 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15760 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15761 | |
| 15762 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15763 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15764 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15765 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15766 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15767 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15768 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15769 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15770 | /* hp used DAC 3 (Front) */ |
| 15771 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15772 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15773 | { } |
| 15774 | }; |
| 15775 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15776 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15777 | /* |
| 15778 | * Unmute ADC0 and set the default input to mic-in |
| 15779 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15780 | /* port-A for surround (rear panel) |
| 15781 | * according to codec#0 this is the HP jack |
| 15782 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15783 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15784 | /* route front PCM to HP */ |
| 15785 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15786 | /* port-B for mic-in (rear panel) with vref */ |
| 15787 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15788 | /* port-C for line-in (rear panel) */ |
| 15789 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15790 | /* port-D for Front */ |
| 15791 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15792 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15793 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15794 | /* this has to be set to VREF80 */ |
| 15795 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15796 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15797 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15798 | /* port-F for mic-in (front panel) with vref */ |
| 15799 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15800 | /* port-G for CLFE (rear panel) */ |
| 15801 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15802 | /* port-H for side (rear panel) */ |
| 15803 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15804 | /* CD-in */ |
| 15805 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15806 | /* route front mic to ADC1*/ |
| 15807 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15808 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15809 | /* Unmute DAC0~3 & spdif out*/ |
| 15810 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15811 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15812 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15813 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15814 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15815 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15816 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15817 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15818 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15819 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15820 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15821 | /* Unmute Stereo Mixer 15 */ |
| 15822 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15823 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15824 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15825 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15826 | |
| 15827 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15828 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15829 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15830 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15831 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15832 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15833 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15834 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15835 | /* hp used DAC 3 (Front) */ |
| 15836 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15837 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15838 | { } |
| 15839 | }; |
| 15840 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15841 | /* additional init verbs for ASUS laptops */ |
| 15842 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15843 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15844 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15845 | { } |
| 15846 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15847 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15848 | /* |
| 15849 | * generic initialization of ADC, input mixers and output mixers |
| 15850 | */ |
| 15851 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15852 | /* |
| 15853 | * Unmute ADC0 and set the default input to mic-in |
| 15854 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15855 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15856 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15857 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15858 | /* Unmute DAC0~3 & spdif out*/ |
| 15859 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15860 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15861 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15862 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15863 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15864 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15865 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15866 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15867 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15868 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15869 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15870 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15871 | /* Unmute Stereo Mixer 15 */ |
| 15872 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15873 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15875 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15876 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15877 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15878 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15879 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15880 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15881 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15882 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15883 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15884 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15885 | |
| 15886 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15887 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15888 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15889 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15890 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15891 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15892 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15893 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15894 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15895 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15896 | |
| 15897 | { } |
| 15898 | }; |
| 15899 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15900 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15901 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15902 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15903 | { } |
| 15904 | }; |
| 15905 | |
| 15906 | /* toggle speaker-output according to the hp-jack state */ |
| 15907 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15908 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15909 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15910 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15911 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15912 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15913 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15914 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15915 | } |
| 15916 | |
| 15917 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15918 | unsigned int res) |
| 15919 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15920 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15921 | alc861_toshiba_automute(codec); |
| 15922 | } |
| 15923 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15924 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15925 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15926 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15927 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15928 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15929 | |
| 15930 | |
| 15931 | #define ALC861_DIGOUT_NID 0x07 |
| 15932 | |
| 15933 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15934 | { 8, NULL } |
| 15935 | }; |
| 15936 | |
| 15937 | static hda_nid_t alc861_dac_nids[4] = { |
| 15938 | /* front, surround, clfe, side */ |
| 15939 | 0x03, 0x06, 0x05, 0x04 |
| 15940 | }; |
| 15941 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15942 | static hda_nid_t alc660_dac_nids[3] = { |
| 15943 | /* front, clfe, surround */ |
| 15944 | 0x03, 0x05, 0x06 |
| 15945 | }; |
| 15946 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15947 | static hda_nid_t alc861_adc_nids[1] = { |
| 15948 | /* ADC0-2 */ |
| 15949 | 0x08, |
| 15950 | }; |
| 15951 | |
| 15952 | static struct hda_input_mux alc861_capture_source = { |
| 15953 | .num_items = 5, |
| 15954 | .items = { |
| 15955 | { "Mic", 0x0 }, |
| 15956 | { "Front Mic", 0x3 }, |
| 15957 | { "Line", 0x1 }, |
| 15958 | { "CD", 0x4 }, |
| 15959 | { "Mixer", 0x5 }, |
| 15960 | }, |
| 15961 | }; |
| 15962 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15963 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15964 | { |
| 15965 | struct alc_spec *spec = codec->spec; |
| 15966 | hda_nid_t mix, srcs[5]; |
| 15967 | int i, j, num; |
| 15968 | |
| 15969 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15970 | return 0; |
| 15971 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15972 | if (num < 0) |
| 15973 | return 0; |
| 15974 | for (i = 0; i < num; i++) { |
| 15975 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15976 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15977 | if (type != AC_WID_AUD_OUT) |
| 15978 | continue; |
| 15979 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15980 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15981 | break; |
| 15982 | if (j >= spec->multiout.num_dacs) |
| 15983 | return srcs[i]; |
| 15984 | } |
| 15985 | return 0; |
| 15986 | } |
| 15987 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15988 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15989 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15990 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15991 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15992 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15993 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15994 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15995 | |
| 15996 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15997 | for (i = 0; i < cfg->line_outs; i++) { |
| 15998 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15999 | dac = alc861_look_for_dac(codec, nid); |
| 16000 | if (!dac) |
| 16001 | continue; |
| 16002 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16003 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16004 | return 0; |
| 16005 | } |
| 16006 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16007 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 16008 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16009 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16010 | 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] | 16011 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 16012 | } |
| 16013 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16014 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 16015 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 16016 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16017 | /* add playback controls from the parsed DAC table */ |
| 16018 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 16019 | const struct auto_pin_cfg *cfg) |
| 16020 | { |
| 16021 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16022 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16023 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16024 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16025 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16026 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16027 | int i, err; |
| 16028 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16029 | for (i = 0; i < cfg->line_outs; i++) { |
| 16030 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16031 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16032 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16033 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16034 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16035 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16036 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16037 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16038 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16039 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16040 | return err; |
| 16041 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16042 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 16043 | int index = i; |
| 16044 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16045 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 16046 | index = 0; |
| 16047 | } |
| 16048 | err = __alc861_create_out_sw(codec, name, nid, index, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16049 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16050 | return err; |
| 16051 | } |
| 16052 | } |
| 16053 | return 0; |
| 16054 | } |
| 16055 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16056 | 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] | 16057 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16058 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16059 | int err; |
| 16060 | hda_nid_t nid; |
| 16061 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16062 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16063 | return 0; |
| 16064 | |
| 16065 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16066 | nid = alc861_look_for_dac(codec, pin); |
| 16067 | if (nid) { |
| 16068 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 16069 | if (err < 0) |
| 16070 | return err; |
| 16071 | spec->multiout.hp_nid = nid; |
| 16072 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16073 | } |
| 16074 | return 0; |
| 16075 | } |
| 16076 | |
| 16077 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16078 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16079 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16080 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16081 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16082 | } |
| 16083 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16084 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16085 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16086 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16087 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16088 | hda_nid_t mix, srcs[5]; |
| 16089 | int i, num; |
| 16090 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16091 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16092 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16093 | 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] | 16094 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16095 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 16096 | return; |
| 16097 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 16098 | if (num < 0) |
| 16099 | return; |
| 16100 | for (i = 0; i < num; i++) { |
| 16101 | unsigned int mute; |
| 16102 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 16103 | mute = AMP_IN_UNMUTE(i); |
| 16104 | else |
| 16105 | mute = AMP_IN_MUTE(i); |
| 16106 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16107 | mute); |
| 16108 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16109 | } |
| 16110 | |
| 16111 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 16112 | { |
| 16113 | struct alc_spec *spec = codec->spec; |
| 16114 | int i; |
| 16115 | |
| 16116 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 16117 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16118 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16119 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16120 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16121 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16122 | } |
| 16123 | } |
| 16124 | |
| 16125 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 16126 | { |
| 16127 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16128 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16129 | if (spec->autocfg.hp_outs) |
| 16130 | alc861_auto_set_output_and_unmute(codec, |
| 16131 | spec->autocfg.hp_pins[0], |
| 16132 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16133 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16134 | if (spec->autocfg.speaker_outs) |
| 16135 | alc861_auto_set_output_and_unmute(codec, |
| 16136 | spec->autocfg.speaker_pins[0], |
| 16137 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16138 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16139 | } |
| 16140 | |
| 16141 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16142 | { |
| 16143 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16144 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16145 | int i; |
| 16146 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16147 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16148 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16149 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16150 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16151 | } |
| 16152 | } |
| 16153 | |
| 16154 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16155 | /* return 1 if successful, 0 if the proper config is not found, |
| 16156 | * or a negative error code |
| 16157 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16158 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16159 | { |
| 16160 | struct alc_spec *spec = codec->spec; |
| 16161 | int err; |
| 16162 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 16163 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16164 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16165 | alc861_ignore); |
| 16166 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16167 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16168 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16169 | return 0; /* can't find valid BIOS pin config */ |
| 16170 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16171 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16172 | if (err < 0) |
| 16173 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16174 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16175 | if (err < 0) |
| 16176 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16177 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16178 | if (err < 0) |
| 16179 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16180 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16181 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16182 | return err; |
| 16183 | |
| 16184 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16185 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16186 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16187 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16188 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16189 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16190 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16191 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16192 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16193 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16194 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16195 | |
| 16196 | spec->adc_nids = alc861_adc_nids; |
| 16197 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16198 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16199 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16200 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16202 | return 1; |
| 16203 | } |
| 16204 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16205 | /* additional initialization for auto-configuration model */ |
| 16206 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16207 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16208 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16209 | alc861_auto_init_multi_out(codec); |
| 16210 | alc861_auto_init_hp_out(codec); |
| 16211 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16212 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16213 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16214 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16215 | } |
| 16216 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16217 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16218 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16219 | { 0x15, HDA_INPUT, 0 }, |
| 16220 | { 0x15, HDA_INPUT, 1 }, |
| 16221 | { 0x15, HDA_INPUT, 2 }, |
| 16222 | { 0x15, HDA_INPUT, 3 }, |
| 16223 | { } /* end */ |
| 16224 | }; |
| 16225 | #endif |
| 16226 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16227 | |
| 16228 | /* |
| 16229 | * configuration and preset |
| 16230 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16231 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16232 | [ALC861_3ST] = "3stack", |
| 16233 | [ALC660_3ST] = "3stack-660", |
| 16234 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16235 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16236 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16237 | [ALC861_TOSHIBA] = "toshiba", |
| 16238 | [ALC861_ASUS] = "asus", |
| 16239 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16240 | [ALC861_AUTO] = "auto", |
| 16241 | }; |
| 16242 | |
| 16243 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16244 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16245 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16246 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16247 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16248 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16249 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16250 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16251 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16252 | * Any other models that need this preset? |
| 16253 | */ |
| 16254 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16255 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16256 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16257 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16258 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16259 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16260 | /* FIXME: the below seems conflict */ |
| 16261 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16262 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16263 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16264 | {} |
| 16265 | }; |
| 16266 | |
| 16267 | static struct alc_config_preset alc861_presets[] = { |
| 16268 | [ALC861_3ST] = { |
| 16269 | .mixers = { alc861_3ST_mixer }, |
| 16270 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16271 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16272 | .dac_nids = alc861_dac_nids, |
| 16273 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16274 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16275 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16276 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16277 | .adc_nids = alc861_adc_nids, |
| 16278 | .input_mux = &alc861_capture_source, |
| 16279 | }, |
| 16280 | [ALC861_3ST_DIG] = { |
| 16281 | .mixers = { alc861_base_mixer }, |
| 16282 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16283 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16284 | .dac_nids = alc861_dac_nids, |
| 16285 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16286 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16287 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16288 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16289 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16290 | .adc_nids = alc861_adc_nids, |
| 16291 | .input_mux = &alc861_capture_source, |
| 16292 | }, |
| 16293 | [ALC861_6ST_DIG] = { |
| 16294 | .mixers = { alc861_base_mixer }, |
| 16295 | .init_verbs = { alc861_base_init_verbs }, |
| 16296 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16297 | .dac_nids = alc861_dac_nids, |
| 16298 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16299 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16300 | .channel_mode = alc861_8ch_modes, |
| 16301 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16302 | .adc_nids = alc861_adc_nids, |
| 16303 | .input_mux = &alc861_capture_source, |
| 16304 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16305 | [ALC660_3ST] = { |
| 16306 | .mixers = { alc861_3ST_mixer }, |
| 16307 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16308 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16309 | .dac_nids = alc660_dac_nids, |
| 16310 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16311 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16312 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16313 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16314 | .adc_nids = alc861_adc_nids, |
| 16315 | .input_mux = &alc861_capture_source, |
| 16316 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16317 | [ALC861_UNIWILL_M31] = { |
| 16318 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16319 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16320 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16321 | .dac_nids = alc861_dac_nids, |
| 16322 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16323 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16324 | .channel_mode = alc861_uniwill_m31_modes, |
| 16325 | .need_dac_fix = 1, |
| 16326 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16327 | .adc_nids = alc861_adc_nids, |
| 16328 | .input_mux = &alc861_capture_source, |
| 16329 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16330 | [ALC861_TOSHIBA] = { |
| 16331 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16332 | .init_verbs = { alc861_base_init_verbs, |
| 16333 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16334 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16335 | .dac_nids = alc861_dac_nids, |
| 16336 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16337 | .channel_mode = alc883_3ST_2ch_modes, |
| 16338 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16339 | .adc_nids = alc861_adc_nids, |
| 16340 | .input_mux = &alc861_capture_source, |
| 16341 | .unsol_event = alc861_toshiba_unsol_event, |
| 16342 | .init_hook = alc861_toshiba_automute, |
| 16343 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16344 | [ALC861_ASUS] = { |
| 16345 | .mixers = { alc861_asus_mixer }, |
| 16346 | .init_verbs = { alc861_asus_init_verbs }, |
| 16347 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16348 | .dac_nids = alc861_dac_nids, |
| 16349 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16350 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16351 | .channel_mode = alc861_asus_modes, |
| 16352 | .need_dac_fix = 1, |
| 16353 | .hp_nid = 0x06, |
| 16354 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16355 | .adc_nids = alc861_adc_nids, |
| 16356 | .input_mux = &alc861_capture_source, |
| 16357 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16358 | [ALC861_ASUS_LAPTOP] = { |
| 16359 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16360 | .init_verbs = { alc861_asus_init_verbs, |
| 16361 | alc861_asus_laptop_init_verbs }, |
| 16362 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16363 | .dac_nids = alc861_dac_nids, |
| 16364 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16365 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16366 | .channel_mode = alc883_3ST_2ch_modes, |
| 16367 | .need_dac_fix = 1, |
| 16368 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16369 | .adc_nids = alc861_adc_nids, |
| 16370 | .input_mux = &alc861_capture_source, |
| 16371 | }, |
| 16372 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16373 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16374 | /* Pin config fixes */ |
| 16375 | enum { |
| 16376 | PINFIX_FSC_AMILO_PI1505, |
| 16377 | }; |
| 16378 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16379 | static const struct alc_fixup alc861_fixups[] = { |
| 16380 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16381 | .type = ALC_FIXUP_PINS, |
| 16382 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16383 | { 0x0b, 0x0221101f }, /* HP */ |
| 16384 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16385 | { } |
| 16386 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16387 | }, |
| 16388 | }; |
| 16389 | |
| 16390 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16391 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16392 | {} |
| 16393 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16394 | |
| 16395 | static int patch_alc861(struct hda_codec *codec) |
| 16396 | { |
| 16397 | struct alc_spec *spec; |
| 16398 | int board_config; |
| 16399 | int err; |
| 16400 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16401 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16402 | if (spec == NULL) |
| 16403 | return -ENOMEM; |
| 16404 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16405 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16406 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16407 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16408 | alc861_models, |
| 16409 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16410 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16411 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16412 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16413 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16414 | board_config = ALC861_AUTO; |
| 16415 | } |
| 16416 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16417 | if (board_config == ALC861_AUTO) { |
| 16418 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16419 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16420 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16421 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16422 | if (board_config == ALC861_AUTO) { |
| 16423 | /* automatic parse from the BIOS config */ |
| 16424 | err = alc861_parse_auto_config(codec); |
| 16425 | if (err < 0) { |
| 16426 | alc_free(codec); |
| 16427 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16428 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16429 | printk(KERN_INFO |
| 16430 | "hda_codec: Cannot set up configuration " |
| 16431 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16432 | board_config = ALC861_3ST_DIG; |
| 16433 | } |
| 16434 | } |
| 16435 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16436 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16437 | if (err < 0) { |
| 16438 | alc_free(codec); |
| 16439 | return err; |
| 16440 | } |
| 16441 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16442 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16443 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16444 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16445 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16446 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16447 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16448 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16449 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16450 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16451 | if (!spec->cap_mixer) |
| 16452 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16453 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16454 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16455 | spec->vmaster_nid = 0x03; |
| 16456 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16457 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16458 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16459 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16460 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16461 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16462 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16463 | spec->power_hook = alc_power_eapd; |
| 16464 | #endif |
| 16465 | } |
| 16466 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16467 | if (!spec->loopback.amplist) |
| 16468 | spec->loopback.amplist = alc861_loopbacks; |
| 16469 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16470 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16471 | return 0; |
| 16472 | } |
| 16473 | |
| 16474 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16475 | * ALC861-VD support |
| 16476 | * |
| 16477 | * Based on ALC882 |
| 16478 | * |
| 16479 | * In addition, an independent DAC |
| 16480 | */ |
| 16481 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16482 | |
| 16483 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16484 | /* front, surr, clfe, side surr */ |
| 16485 | 0x02, 0x03, 0x04, 0x05 |
| 16486 | }; |
| 16487 | |
| 16488 | /* dac_nids for ALC660vd are in a different order - according to |
| 16489 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16490 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16491 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16492 | * - and it is the same as in 861vd. |
| 16493 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16494 | */ |
| 16495 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16496 | /* front, rear, clfe, rear_surr */ |
| 16497 | 0x02, 0x04, 0x03 |
| 16498 | }; |
| 16499 | |
| 16500 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16501 | /* ADC0 */ |
| 16502 | 0x09, |
| 16503 | }; |
| 16504 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16505 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16506 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16507 | /* input MUX */ |
| 16508 | /* FIXME: should be a matrix-type input source selection */ |
| 16509 | static struct hda_input_mux alc861vd_capture_source = { |
| 16510 | .num_items = 4, |
| 16511 | .items = { |
| 16512 | { "Mic", 0x0 }, |
| 16513 | { "Front Mic", 0x1 }, |
| 16514 | { "Line", 0x2 }, |
| 16515 | { "CD", 0x4 }, |
| 16516 | }, |
| 16517 | }; |
| 16518 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16519 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16520 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16521 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16522 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16523 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16524 | }, |
| 16525 | }; |
| 16526 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16527 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16528 | .num_items = 2, |
| 16529 | .items = { |
| 16530 | { "Front Mic", 0x0 }, |
| 16531 | { "ATAPI Mic", 0x1 }, |
| 16532 | }, |
| 16533 | }; |
| 16534 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16535 | /* |
| 16536 | * 2ch mode |
| 16537 | */ |
| 16538 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16539 | { 2, NULL } |
| 16540 | }; |
| 16541 | |
| 16542 | /* |
| 16543 | * 6ch mode |
| 16544 | */ |
| 16545 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16546 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16547 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16548 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16549 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16550 | { } /* end */ |
| 16551 | }; |
| 16552 | |
| 16553 | /* |
| 16554 | * 8ch mode |
| 16555 | */ |
| 16556 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16557 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16558 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16559 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16560 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16561 | { } /* end */ |
| 16562 | }; |
| 16563 | |
| 16564 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16565 | { 6, alc861vd_6stack_ch6_init }, |
| 16566 | { 8, alc861vd_6stack_ch8_init }, |
| 16567 | }; |
| 16568 | |
| 16569 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16570 | { |
| 16571 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16572 | .name = "Channel Mode", |
| 16573 | .info = alc_ch_mode_info, |
| 16574 | .get = alc_ch_mode_get, |
| 16575 | .put = alc_ch_mode_put, |
| 16576 | }, |
| 16577 | { } /* end */ |
| 16578 | }; |
| 16579 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16580 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16581 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16582 | */ |
| 16583 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16584 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16585 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16586 | |
| 16587 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16588 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16589 | |
| 16590 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16591 | HDA_OUTPUT), |
| 16592 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16593 | HDA_OUTPUT), |
| 16594 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16595 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16596 | |
| 16597 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16598 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16599 | |
| 16600 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16601 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16602 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16603 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16605 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16606 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16607 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16608 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16609 | |
| 16610 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16611 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16612 | |
| 16613 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16614 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16615 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16616 | { } /* end */ |
| 16617 | }; |
| 16618 | |
| 16619 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16620 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16621 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16622 | |
| 16623 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16624 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16625 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16626 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16627 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16628 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16629 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16630 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16631 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16632 | |
| 16633 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16634 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16635 | |
| 16636 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16637 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16638 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16639 | { } /* end */ |
| 16640 | }; |
| 16641 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16642 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16643 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16644 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16645 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16646 | |
| 16647 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16648 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16649 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16650 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16651 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16652 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16653 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16654 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16655 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16656 | |
| 16657 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16658 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16659 | |
| 16660 | { } /* end */ |
| 16661 | }; |
| 16662 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16663 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16664 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16665 | */ |
| 16666 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16667 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16668 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16669 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16670 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16671 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16672 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16673 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16674 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16675 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16676 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16677 | { } /* end */ |
| 16678 | }; |
| 16679 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16680 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16681 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16682 | */ |
| 16683 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16684 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16685 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16686 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16687 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16688 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16689 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16690 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16691 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16692 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16693 | { } /* end */ |
| 16694 | }; |
| 16695 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16696 | /* |
| 16697 | * generic initialization of ADC, input mixers and output mixers |
| 16698 | */ |
| 16699 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16700 | /* |
| 16701 | * Unmute ADC0 and set the default input to mic-in |
| 16702 | */ |
| 16703 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16704 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16705 | |
| 16706 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16707 | * the analog-loopback mixer widget |
| 16708 | */ |
| 16709 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16710 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16711 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16712 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16713 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16714 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16715 | |
| 16716 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16717 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16718 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16719 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16720 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16721 | |
| 16722 | /* |
| 16723 | * Set up output mixers (0x02 - 0x05) |
| 16724 | */ |
| 16725 | /* set vol=0 to output mixers */ |
| 16726 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16727 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16728 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16729 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16730 | |
| 16731 | /* set up input amps for analog loopback */ |
| 16732 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16733 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16734 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16735 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16736 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16737 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16738 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16739 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16740 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16741 | |
| 16742 | { } |
| 16743 | }; |
| 16744 | |
| 16745 | /* |
| 16746 | * 3-stack pin configuration: |
| 16747 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16748 | */ |
| 16749 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16750 | /* |
| 16751 | * Set pin mode and muting |
| 16752 | */ |
| 16753 | /* set front pin widgets 0x14 for output */ |
| 16754 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16755 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16756 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16757 | |
| 16758 | /* Mic (rear) pin: input vref at 80% */ |
| 16759 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16760 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16761 | /* Front Mic pin: input vref at 80% */ |
| 16762 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16763 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16764 | /* Line In pin: input */ |
| 16765 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16766 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16767 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16768 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16769 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16770 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16771 | /* CD pin widget for input */ |
| 16772 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16773 | |
| 16774 | { } |
| 16775 | }; |
| 16776 | |
| 16777 | /* |
| 16778 | * 6-stack pin configuration: |
| 16779 | */ |
| 16780 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16781 | /* |
| 16782 | * Set pin mode and muting |
| 16783 | */ |
| 16784 | /* set front pin widgets 0x14 for output */ |
| 16785 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16786 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16787 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16788 | |
| 16789 | /* Rear Pin: output 1 (0x0d) */ |
| 16790 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16791 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16792 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16793 | /* CLFE Pin: output 2 (0x0e) */ |
| 16794 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16795 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16796 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16797 | /* Side Pin: output 3 (0x0f) */ |
| 16798 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16799 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16800 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16801 | |
| 16802 | /* Mic (rear) pin: input vref at 80% */ |
| 16803 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16804 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16805 | /* Front Mic pin: input vref at 80% */ |
| 16806 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16807 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16808 | /* Line In pin: input */ |
| 16809 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16810 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16811 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16812 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16813 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16814 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16815 | /* CD pin widget for input */ |
| 16816 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16817 | |
| 16818 | { } |
| 16819 | }; |
| 16820 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16821 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16822 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16823 | { } |
| 16824 | }; |
| 16825 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16826 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16827 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16828 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16829 | { } |
| 16830 | }; |
| 16831 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16832 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16833 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16834 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16835 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16836 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16837 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16838 | {} |
| 16839 | }; |
| 16840 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16841 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16842 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16843 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16844 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16845 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16846 | } |
| 16847 | |
| 16848 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16849 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16850 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16851 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16852 | } |
| 16853 | |
| 16854 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16855 | unsigned int res) |
| 16856 | { |
| 16857 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16858 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16859 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16860 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16861 | default: |
| 16862 | alc_automute_amp_unsol_event(codec, res); |
| 16863 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16864 | } |
| 16865 | } |
| 16866 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16867 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16868 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16869 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16870 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16871 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16872 | |
| 16873 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16874 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16875 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16876 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16877 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16878 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16879 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16880 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16881 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16882 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16883 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16884 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16885 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16886 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16887 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16888 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16889 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16890 | |
| 16891 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16892 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16893 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16894 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16895 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16896 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16897 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16898 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16899 | |
| 16900 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16901 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16902 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16903 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16904 | |
| 16905 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16906 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16907 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16908 | |
| 16909 | { } /* end */ |
| 16910 | }; |
| 16911 | |
| 16912 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16913 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16914 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16915 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16916 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16917 | spec->autocfg.hp_pins[0] = 0x15; |
| 16918 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16919 | } |
| 16920 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16921 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16922 | #define alc861vd_loopbacks alc880_loopbacks |
| 16923 | #endif |
| 16924 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16925 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16926 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16927 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16928 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16929 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16930 | |
| 16931 | /* |
| 16932 | * configuration and preset |
| 16933 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16934 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16935 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16936 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16937 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16938 | [ALC861VD_3ST] = "3stack", |
| 16939 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16940 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16941 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16942 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16943 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16944 | [ALC861VD_AUTO] = "auto", |
| 16945 | }; |
| 16946 | |
| 16947 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16948 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16949 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16950 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16951 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16952 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16953 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16954 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16955 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16956 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16957 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16958 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16959 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16960 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16961 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16962 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16963 | {} |
| 16964 | }; |
| 16965 | |
| 16966 | static struct alc_config_preset alc861vd_presets[] = { |
| 16967 | [ALC660VD_3ST] = { |
| 16968 | .mixers = { alc861vd_3st_mixer }, |
| 16969 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16970 | alc861vd_3stack_init_verbs }, |
| 16971 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16972 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16973 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16974 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16975 | .input_mux = &alc861vd_capture_source, |
| 16976 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16977 | [ALC660VD_3ST_DIG] = { |
| 16978 | .mixers = { alc861vd_3st_mixer }, |
| 16979 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16980 | alc861vd_3stack_init_verbs }, |
| 16981 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16982 | .dac_nids = alc660vd_dac_nids, |
| 16983 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16984 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16985 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16986 | .input_mux = &alc861vd_capture_source, |
| 16987 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16988 | [ALC861VD_3ST] = { |
| 16989 | .mixers = { alc861vd_3st_mixer }, |
| 16990 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16991 | alc861vd_3stack_init_verbs }, |
| 16992 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16993 | .dac_nids = alc861vd_dac_nids, |
| 16994 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16995 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16996 | .input_mux = &alc861vd_capture_source, |
| 16997 | }, |
| 16998 | [ALC861VD_3ST_DIG] = { |
| 16999 | .mixers = { alc861vd_3st_mixer }, |
| 17000 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17001 | alc861vd_3stack_init_verbs }, |
| 17002 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17003 | .dac_nids = alc861vd_dac_nids, |
| 17004 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17005 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17006 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17007 | .input_mux = &alc861vd_capture_source, |
| 17008 | }, |
| 17009 | [ALC861VD_6ST_DIG] = { |
| 17010 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 17011 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17012 | alc861vd_6stack_init_verbs }, |
| 17013 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17014 | .dac_nids = alc861vd_dac_nids, |
| 17015 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17016 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 17017 | .channel_mode = alc861vd_6stack_modes, |
| 17018 | .input_mux = &alc861vd_capture_source, |
| 17019 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17020 | [ALC861VD_LENOVO] = { |
| 17021 | .mixers = { alc861vd_lenovo_mixer }, |
| 17022 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17023 | alc861vd_3stack_init_verbs, |
| 17024 | alc861vd_eapd_verbs, |
| 17025 | alc861vd_lenovo_unsol_verbs }, |
| 17026 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17027 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17028 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17029 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17030 | .input_mux = &alc861vd_capture_source, |
| 17031 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17032 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17033 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17034 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17035 | [ALC861VD_DALLAS] = { |
| 17036 | .mixers = { alc861vd_dallas_mixer }, |
| 17037 | .init_verbs = { alc861vd_dallas_verbs }, |
| 17038 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17039 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17040 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17041 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17042 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17043 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17044 | .setup = alc861vd_dallas_setup, |
| 17045 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17046 | }, |
| 17047 | [ALC861VD_HP] = { |
| 17048 | .mixers = { alc861vd_hp_mixer }, |
| 17049 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 17050 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17051 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17052 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17053 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17054 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17055 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17056 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17057 | .setup = alc861vd_dallas_setup, |
| 17058 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17059 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17060 | [ALC660VD_ASUS_V1S] = { |
| 17061 | .mixers = { alc861vd_lenovo_mixer }, |
| 17062 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17063 | alc861vd_3stack_init_verbs, |
| 17064 | alc861vd_eapd_verbs, |
| 17065 | alc861vd_lenovo_unsol_verbs }, |
| 17066 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17067 | .dac_nids = alc660vd_dac_nids, |
| 17068 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17069 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17070 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17071 | .input_mux = &alc861vd_capture_source, |
| 17072 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17073 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17074 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17075 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17076 | }; |
| 17077 | |
| 17078 | /* |
| 17079 | * BIOS auto configuration |
| 17080 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17081 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 17082 | const struct auto_pin_cfg *cfg) |
| 17083 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 17084 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17085 | } |
| 17086 | |
| 17087 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17088 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17089 | hda_nid_t nid, int pin_type, int dac_idx) |
| 17090 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17091 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17092 | } |
| 17093 | |
| 17094 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 17095 | { |
| 17096 | struct alc_spec *spec = codec->spec; |
| 17097 | int i; |
| 17098 | |
| 17099 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17100 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17101 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17102 | if (nid) |
| 17103 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17104 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17105 | } |
| 17106 | } |
| 17107 | |
| 17108 | |
| 17109 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 17110 | { |
| 17111 | struct alc_spec *spec = codec->spec; |
| 17112 | hda_nid_t pin; |
| 17113 | |
| 17114 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17115 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17116 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17117 | pin = spec->autocfg.speaker_pins[0]; |
| 17118 | if (pin) |
| 17119 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17120 | } |
| 17121 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17122 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 17123 | |
| 17124 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 17125 | { |
| 17126 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17127 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17128 | int i; |
| 17129 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17130 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17131 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17132 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17133 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17134 | if (nid != ALC861VD_PIN_CD_NID && |
| 17135 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17136 | snd_hda_codec_write(codec, nid, 0, |
| 17137 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17138 | AMP_OUT_MUTE); |
| 17139 | } |
| 17140 | } |
| 17141 | } |
| 17142 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17143 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17144 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17145 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17146 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17147 | |
| 17148 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 17149 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17150 | * different NIDs for mute/unmute switch and volume control */ |
| 17151 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17152 | const struct auto_pin_cfg *cfg) |
| 17153 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 17154 | static const char * const chname[4] = { |
| 17155 | "Front", "Surround", "CLFE", "Side" |
| 17156 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17157 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17158 | hda_nid_t nid_v, nid_s; |
| 17159 | int i, err; |
| 17160 | |
| 17161 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17162 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17163 | continue; |
| 17164 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17165 | alc880_dac_to_idx( |
| 17166 | spec->multiout.dac_nids[i])); |
| 17167 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17168 | alc880_dac_to_idx( |
| 17169 | spec->multiout.dac_nids[i])); |
| 17170 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17171 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17172 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17173 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17174 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17175 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17176 | HDA_OUTPUT)); |
| 17177 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17178 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17179 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17180 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17181 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17182 | HDA_OUTPUT)); |
| 17183 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17184 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17185 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17186 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17187 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17188 | HDA_INPUT)); |
| 17189 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17190 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17191 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17192 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17193 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17194 | HDA_INPUT)); |
| 17195 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17196 | return err; |
| 17197 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17198 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17199 | int index = i; |
| 17200 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17201 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17202 | index = 0; |
| 17203 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17204 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17205 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17206 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17207 | HDA_OUTPUT)); |
| 17208 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17209 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17210 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17211 | name, index, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17212 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17213 | HDA_INPUT)); |
| 17214 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17215 | return err; |
| 17216 | } |
| 17217 | } |
| 17218 | return 0; |
| 17219 | } |
| 17220 | |
| 17221 | /* add playback controls for speaker and HP outputs */ |
| 17222 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17223 | * different NIDs for mute/unmute switch and volume control */ |
| 17224 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17225 | hda_nid_t pin, const char *pfx) |
| 17226 | { |
| 17227 | hda_nid_t nid_v, nid_s; |
| 17228 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17229 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17230 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17231 | return 0; |
| 17232 | |
| 17233 | if (alc880_is_fixed_pin(pin)) { |
| 17234 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17235 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17236 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17237 | spec->multiout.hp_nid = nid_v; |
| 17238 | else |
| 17239 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17240 | /* control HP volume/switch on the output mixer amp */ |
| 17241 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17242 | alc880_fixed_pin_idx(pin)); |
| 17243 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17244 | alc880_fixed_pin_idx(pin)); |
| 17245 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17246 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17247 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17248 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17249 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17250 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17251 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17252 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17253 | return err; |
| 17254 | } else if (alc880_is_multi_pin(pin)) { |
| 17255 | /* set manual connection */ |
| 17256 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17257 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17258 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17259 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17260 | return err; |
| 17261 | } |
| 17262 | return 0; |
| 17263 | } |
| 17264 | |
| 17265 | /* parse the BIOS configuration and set up the alc_spec |
| 17266 | * return 1 if successful, 0 if the proper config is not found, |
| 17267 | * or a negative error code |
| 17268 | * Based on ALC880 version - had to change it to override |
| 17269 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17270 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17271 | { |
| 17272 | struct alc_spec *spec = codec->spec; |
| 17273 | int err; |
| 17274 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17275 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17276 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17277 | alc861vd_ignore); |
| 17278 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17279 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17280 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17281 | return 0; /* can't find valid BIOS pin config */ |
| 17282 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17283 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17284 | if (err < 0) |
| 17285 | return err; |
| 17286 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17287 | if (err < 0) |
| 17288 | return err; |
| 17289 | err = alc861vd_auto_create_extra_out(spec, |
| 17290 | spec->autocfg.speaker_pins[0], |
| 17291 | "Speaker"); |
| 17292 | if (err < 0) |
| 17293 | return err; |
| 17294 | err = alc861vd_auto_create_extra_out(spec, |
| 17295 | spec->autocfg.hp_pins[0], |
| 17296 | "Headphone"); |
| 17297 | if (err < 0) |
| 17298 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17299 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17300 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17301 | return err; |
| 17302 | |
| 17303 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17304 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17305 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17306 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17307 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17308 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17309 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17310 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17311 | |
| 17312 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17313 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17314 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17315 | err = alc_auto_add_mic_boost(codec); |
| 17316 | if (err < 0) |
| 17317 | return err; |
| 17318 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17319 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17320 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17321 | return 1; |
| 17322 | } |
| 17323 | |
| 17324 | /* additional initialization for auto-configuration model */ |
| 17325 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17326 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17327 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17328 | alc861vd_auto_init_multi_out(codec); |
| 17329 | alc861vd_auto_init_hp_out(codec); |
| 17330 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17331 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17332 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17333 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17334 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17335 | } |
| 17336 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17337 | enum { |
| 17338 | ALC660VD_FIX_ASUS_GPIO1 |
| 17339 | }; |
| 17340 | |
| 17341 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17342 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17343 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17344 | .type = ALC_FIXUP_VERBS, |
| 17345 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17346 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17347 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17348 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17349 | { } |
| 17350 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17351 | }, |
| 17352 | }; |
| 17353 | |
| 17354 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17355 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17356 | {} |
| 17357 | }; |
| 17358 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17359 | static int patch_alc861vd(struct hda_codec *codec) |
| 17360 | { |
| 17361 | struct alc_spec *spec; |
| 17362 | int err, board_config; |
| 17363 | |
| 17364 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17365 | if (spec == NULL) |
| 17366 | return -ENOMEM; |
| 17367 | |
| 17368 | codec->spec = spec; |
| 17369 | |
| 17370 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17371 | alc861vd_models, |
| 17372 | alc861vd_cfg_tbl); |
| 17373 | |
| 17374 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17375 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17376 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17377 | board_config = ALC861VD_AUTO; |
| 17378 | } |
| 17379 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17380 | if (board_config == ALC861VD_AUTO) { |
| 17381 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17382 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17383 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17384 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17385 | if (board_config == ALC861VD_AUTO) { |
| 17386 | /* automatic parse from the BIOS config */ |
| 17387 | err = alc861vd_parse_auto_config(codec); |
| 17388 | if (err < 0) { |
| 17389 | alc_free(codec); |
| 17390 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17391 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17392 | printk(KERN_INFO |
| 17393 | "hda_codec: Cannot set up configuration " |
| 17394 | "from BIOS. Using base mode...\n"); |
| 17395 | board_config = ALC861VD_3ST; |
| 17396 | } |
| 17397 | } |
| 17398 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17399 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17400 | if (err < 0) { |
| 17401 | alc_free(codec); |
| 17402 | return err; |
| 17403 | } |
| 17404 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17405 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17406 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17407 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17408 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17409 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17410 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17411 | } |
| 17412 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17413 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17414 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17415 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17416 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17417 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17418 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17419 | if (!spec->adc_nids) { |
| 17420 | spec->adc_nids = alc861vd_adc_nids; |
| 17421 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17422 | } |
| 17423 | if (!spec->capsrc_nids) |
| 17424 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17425 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17426 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17427 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17428 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17429 | spec->vmaster_nid = 0x02; |
| 17430 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17431 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17432 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17433 | codec->patch_ops = alc_patch_ops; |
| 17434 | |
| 17435 | if (board_config == ALC861VD_AUTO) |
| 17436 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17437 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17438 | if (!spec->loopback.amplist) |
| 17439 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17440 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17441 | |
| 17442 | return 0; |
| 17443 | } |
| 17444 | |
| 17445 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17446 | * ALC662 support |
| 17447 | * |
| 17448 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17449 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17450 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17451 | * 6-channel independent captures. |
| 17452 | * |
| 17453 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17454 | * driver yet). |
| 17455 | */ |
| 17456 | #define ALC662_DIGOUT_NID 0x06 |
| 17457 | #define ALC662_DIGIN_NID 0x0a |
| 17458 | |
| 17459 | static hda_nid_t alc662_dac_nids[4] = { |
| 17460 | /* front, rear, clfe, rear_surr */ |
| 17461 | 0x02, 0x03, 0x04 |
| 17462 | }; |
| 17463 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17464 | static hda_nid_t alc272_dac_nids[2] = { |
| 17465 | 0x02, 0x03 |
| 17466 | }; |
| 17467 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17468 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17469 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17470 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17471 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17472 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17473 | static hda_nid_t alc272_adc_nids[1] = { |
| 17474 | /* ADC1-2 */ |
| 17475 | 0x08, |
| 17476 | }; |
| 17477 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17478 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17479 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17480 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17481 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17482 | /* input MUX */ |
| 17483 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17484 | static struct hda_input_mux alc662_capture_source = { |
| 17485 | .num_items = 4, |
| 17486 | .items = { |
| 17487 | { "Mic", 0x0 }, |
| 17488 | { "Front Mic", 0x1 }, |
| 17489 | { "Line", 0x2 }, |
| 17490 | { "CD", 0x4 }, |
| 17491 | }, |
| 17492 | }; |
| 17493 | |
| 17494 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17495 | .num_items = 2, |
| 17496 | .items = { |
| 17497 | { "Mic", 0x1 }, |
| 17498 | { "Line", 0x2 }, |
| 17499 | }, |
| 17500 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17501 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17502 | static struct hda_input_mux alc663_capture_source = { |
| 17503 | .num_items = 3, |
| 17504 | .items = { |
| 17505 | { "Mic", 0x0 }, |
| 17506 | { "Front Mic", 0x1 }, |
| 17507 | { "Line", 0x2 }, |
| 17508 | }, |
| 17509 | }; |
| 17510 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17511 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17512 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17513 | .num_items = 16, |
| 17514 | .items = { |
| 17515 | { "Autoselect Mic", 0x0 }, |
| 17516 | { "Internal Mic", 0x1 }, |
| 17517 | { "In-0x02", 0x2 }, |
| 17518 | { "In-0x03", 0x3 }, |
| 17519 | { "In-0x04", 0x4 }, |
| 17520 | { "In-0x05", 0x5 }, |
| 17521 | { "In-0x06", 0x6 }, |
| 17522 | { "In-0x07", 0x7 }, |
| 17523 | { "In-0x08", 0x8 }, |
| 17524 | { "In-0x09", 0x9 }, |
| 17525 | { "In-0x0a", 0x0a }, |
| 17526 | { "In-0x0b", 0x0b }, |
| 17527 | { "In-0x0c", 0x0c }, |
| 17528 | { "In-0x0d", 0x0d }, |
| 17529 | { "In-0x0e", 0x0e }, |
| 17530 | { "In-0x0f", 0x0f }, |
| 17531 | }, |
| 17532 | }; |
| 17533 | #endif |
| 17534 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17535 | /* |
| 17536 | * 2ch mode |
| 17537 | */ |
| 17538 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17539 | { 2, NULL } |
| 17540 | }; |
| 17541 | |
| 17542 | /* |
| 17543 | * 2ch mode |
| 17544 | */ |
| 17545 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17546 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17547 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17548 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17549 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17550 | { } /* end */ |
| 17551 | }; |
| 17552 | |
| 17553 | /* |
| 17554 | * 6ch mode |
| 17555 | */ |
| 17556 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17557 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17558 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17559 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17560 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17561 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17562 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17563 | { } /* end */ |
| 17564 | }; |
| 17565 | |
| 17566 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17567 | { 2, alc662_3ST_ch2_init }, |
| 17568 | { 6, alc662_3ST_ch6_init }, |
| 17569 | }; |
| 17570 | |
| 17571 | /* |
| 17572 | * 2ch mode |
| 17573 | */ |
| 17574 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17575 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17576 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17577 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17578 | { } /* end */ |
| 17579 | }; |
| 17580 | |
| 17581 | /* |
| 17582 | * 6ch mode |
| 17583 | */ |
| 17584 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17585 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17586 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17587 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17588 | { } /* end */ |
| 17589 | }; |
| 17590 | |
| 17591 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17592 | { 2, alc662_sixstack_ch6_init }, |
| 17593 | { 6, alc662_sixstack_ch8_init }, |
| 17594 | }; |
| 17595 | |
| 17596 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17597 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17598 | */ |
| 17599 | |
| 17600 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17601 | /* output mixer control */ |
| 17602 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 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_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17605 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17606 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17607 | 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] | 17608 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17609 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17610 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17611 | |
| 17612 | /*Input mixer control */ |
| 17613 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17614 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17615 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17616 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17617 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17618 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17619 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17620 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17621 | { } /* end */ |
| 17622 | }; |
| 17623 | |
| 17624 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17625 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17626 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17627 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17628 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17629 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17630 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17631 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17632 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17633 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17634 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17635 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17636 | { } /* end */ |
| 17637 | }; |
| 17638 | |
| 17639 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17640 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17641 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17642 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17643 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17644 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17645 | 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] | 17646 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17647 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17648 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17649 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17650 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17651 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17652 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17653 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17654 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17655 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17656 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17657 | { } /* end */ |
| 17658 | }; |
| 17659 | |
| 17660 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17661 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17662 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17663 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17664 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17665 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17666 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17667 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17668 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17669 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17670 | { } /* end */ |
| 17671 | }; |
| 17672 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17673 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17674 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17675 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17676 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17677 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17678 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17679 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17680 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17681 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17682 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17683 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17684 | { } /* end */ |
| 17685 | }; |
| 17686 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17687 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17688 | ALC262_HIPPO_MASTER_SWITCH, |
| 17689 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17690 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17691 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17692 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17693 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17694 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17695 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17696 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17697 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17698 | { } /* end */ |
| 17699 | }; |
| 17700 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17701 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17702 | .ops = &snd_hda_bind_vol, |
| 17703 | .values = { |
| 17704 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17705 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17706 | 0 |
| 17707 | }, |
| 17708 | }; |
| 17709 | |
| 17710 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17711 | .ops = &snd_hda_bind_sw, |
| 17712 | .values = { |
| 17713 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17714 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17715 | 0 |
| 17716 | }, |
| 17717 | }; |
| 17718 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17719 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17720 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17721 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17722 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17724 | { } /* end */ |
| 17725 | }; |
| 17726 | |
| 17727 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17728 | .ops = &snd_hda_bind_sw, |
| 17729 | .values = { |
| 17730 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17731 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17732 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17733 | 0 |
| 17734 | }, |
| 17735 | }; |
| 17736 | |
| 17737 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17738 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17739 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17740 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17741 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17742 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17743 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17744 | |
| 17745 | { } /* end */ |
| 17746 | }; |
| 17747 | |
| 17748 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17749 | .ops = &snd_hda_bind_sw, |
| 17750 | .values = { |
| 17751 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17752 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17753 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17754 | 0 |
| 17755 | }, |
| 17756 | }; |
| 17757 | |
| 17758 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17759 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17760 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17761 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17762 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17763 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17764 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17765 | { } /* end */ |
| 17766 | }; |
| 17767 | |
| 17768 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17769 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17770 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17771 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17772 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17774 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17775 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17776 | { } /* end */ |
| 17777 | }; |
| 17778 | |
| 17779 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17780 | .ops = &snd_hda_bind_vol, |
| 17781 | .values = { |
| 17782 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17783 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17784 | 0 |
| 17785 | }, |
| 17786 | }; |
| 17787 | |
| 17788 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17789 | .ops = &snd_hda_bind_sw, |
| 17790 | .values = { |
| 17791 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17792 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17793 | 0 |
| 17794 | }, |
| 17795 | }; |
| 17796 | |
| 17797 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17798 | HDA_BIND_VOL("Master Playback Volume", |
| 17799 | &alc663_asus_two_bind_master_vol), |
| 17800 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17801 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17802 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17805 | { } /* end */ |
| 17806 | }; |
| 17807 | |
| 17808 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17809 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17810 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17811 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17812 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17813 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17814 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17815 | { } /* end */ |
| 17816 | }; |
| 17817 | |
| 17818 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17819 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17820 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17821 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17822 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17823 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17824 | |
| 17825 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17827 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17828 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17829 | { } /* end */ |
| 17830 | }; |
| 17831 | |
| 17832 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17833 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17834 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17835 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17836 | |
| 17837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17839 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17840 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17841 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17842 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17843 | { } /* end */ |
| 17844 | }; |
| 17845 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17846 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17847 | .ops = &snd_hda_bind_sw, |
| 17848 | .values = { |
| 17849 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17850 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17851 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17852 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17853 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17854 | 0 |
| 17855 | }, |
| 17856 | }; |
| 17857 | |
| 17858 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17859 | .ops = &snd_hda_bind_sw, |
| 17860 | .values = { |
| 17861 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17862 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17863 | 0 |
| 17864 | }, |
| 17865 | }; |
| 17866 | |
| 17867 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17868 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17869 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17870 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17871 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17872 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17873 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17874 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17875 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17876 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17877 | { } /* end */ |
| 17878 | }; |
| 17879 | |
| 17880 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17881 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17882 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17883 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17884 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17885 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17886 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17887 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17888 | { } /* end */ |
| 17889 | }; |
| 17890 | |
| 17891 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17892 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17893 | { |
| 17894 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17895 | .name = "Channel Mode", |
| 17896 | .info = alc_ch_mode_info, |
| 17897 | .get = alc_ch_mode_get, |
| 17898 | .put = alc_ch_mode_put, |
| 17899 | }, |
| 17900 | { } /* end */ |
| 17901 | }; |
| 17902 | |
| 17903 | static struct hda_verb alc662_init_verbs[] = { |
| 17904 | /* ADC: mute amp left and right */ |
| 17905 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17906 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17907 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17908 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17910 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17911 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17912 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17913 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17914 | |
| 17915 | /* Front Pin: output 0 (0x0c) */ |
| 17916 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17917 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17918 | |
| 17919 | /* Rear Pin: output 1 (0x0d) */ |
| 17920 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17921 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17922 | |
| 17923 | /* CLFE Pin: output 2 (0x0e) */ |
| 17924 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17925 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17926 | |
| 17927 | /* Mic (rear) pin: input vref at 80% */ |
| 17928 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17929 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17930 | /* Front Mic pin: input vref at 80% */ |
| 17931 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17932 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17933 | /* Line In pin: input */ |
| 17934 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17935 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17936 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17937 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17938 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17939 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17940 | /* CD pin widget for input */ |
| 17941 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17942 | |
| 17943 | /* FIXME: use matrix-type input source selection */ |
| 17944 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17945 | /* Input mixer */ |
| 17946 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17947 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17948 | |
| 17949 | /* always trun on EAPD */ |
| 17950 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17951 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17952 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17953 | { } |
| 17954 | }; |
| 17955 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17956 | static struct hda_verb alc663_init_verbs[] = { |
| 17957 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17958 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17959 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17960 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17961 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17962 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17963 | { } |
| 17964 | }; |
| 17965 | |
| 17966 | static struct hda_verb alc272_init_verbs[] = { |
| 17967 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17968 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17969 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17970 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17971 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17972 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17973 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17974 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17975 | { } |
| 17976 | }; |
| 17977 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17978 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17979 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17980 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17981 | {} |
| 17982 | }; |
| 17983 | |
| 17984 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17985 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17986 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17987 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17988 | }; |
| 17989 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17990 | /* Set Unsolicited Event*/ |
| 17991 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17992 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17993 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17994 | {} |
| 17995 | }; |
| 17996 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17997 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17998 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17999 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18000 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18001 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18002 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18003 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18004 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18005 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18006 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18007 | {} |
| 18008 | }; |
| 18009 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18010 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 18011 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18012 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18013 | {0x21, 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 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18018 | {} |
| 18019 | }; |
| 18020 | |
| 18021 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 18022 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18023 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18024 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18025 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18026 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18027 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18028 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18029 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18030 | {} |
| 18031 | }; |
| 18032 | |
| 18033 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 18034 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18035 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18036 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18037 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18038 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18039 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18040 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18041 | {} |
| 18042 | }; |
| 18043 | |
| 18044 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 18045 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18046 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18047 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18048 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18049 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18050 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18051 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18052 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18053 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18054 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18055 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18056 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18057 | {} |
| 18058 | }; |
| 18059 | |
| 18060 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 18061 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18062 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18063 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18064 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18065 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18066 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18067 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18070 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18071 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18072 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18073 | {} |
| 18074 | }; |
| 18075 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18076 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 18077 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18078 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 18079 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 18080 | |
| 18081 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18082 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18083 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18084 | |
| 18085 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 18086 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 18087 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 18088 | {} |
| 18089 | }; |
| 18090 | |
| 18091 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 18092 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18093 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18094 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18095 | |
| 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 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18101 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 18102 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 18103 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18104 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18105 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18106 | {} |
| 18107 | }; |
| 18108 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18109 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 18110 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18111 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18112 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18113 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18114 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18115 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18116 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18117 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18118 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18119 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18120 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18121 | {} |
| 18122 | }; |
| 18123 | |
| 18124 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 18125 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18126 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18127 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18128 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18129 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18130 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18131 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18132 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18133 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18134 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18135 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18136 | {} |
| 18137 | }; |
| 18138 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18139 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 18140 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18141 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18142 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18143 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18144 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18145 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18146 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18147 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18148 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18149 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18150 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18151 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18152 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18153 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18154 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18155 | {} |
| 18156 | }; |
| 18157 | |
| 18158 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 18159 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18160 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18161 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18162 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18163 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18164 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18165 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18166 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18167 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18168 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18169 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18170 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18171 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18172 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18173 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18174 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18175 | {} |
| 18176 | }; |
| 18177 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18178 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18179 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18180 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18181 | { } /* end */ |
| 18182 | }; |
| 18183 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18184 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18185 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18186 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18187 | { } /* end */ |
| 18188 | }; |
| 18189 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18190 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 18191 | { |
| 18192 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18193 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18194 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18195 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18196 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18197 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18198 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18199 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18200 | } |
| 18201 | |
| 18202 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 18203 | { |
| 18204 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18205 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18206 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18207 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18208 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18209 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18210 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18211 | HDA_AMP_MUTE, bits); |
| 18212 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18213 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18214 | } |
| 18215 | |
| 18216 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 18217 | unsigned int res) |
| 18218 | { |
| 18219 | if ((res >> 26) == ALC880_HP_EVENT) |
| 18220 | alc662_lenovo_101e_all_automute(codec); |
| 18221 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 18222 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 18223 | } |
| 18224 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18225 | /* unsolicited event for HP jack sensing */ |
| 18226 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 18227 | unsigned int res) |
| 18228 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18229 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18230 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18231 | else |
| 18232 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18233 | } |
| 18234 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18235 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18236 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18237 | struct alc_spec *spec = codec->spec; |
| 18238 | |
| 18239 | alc262_hippo1_setup(codec); |
| 18240 | spec->ext_mic.pin = 0x18; |
| 18241 | spec->ext_mic.mux_idx = 0; |
| 18242 | spec->int_mic.pin = 0x19; |
| 18243 | spec->int_mic.mux_idx = 1; |
| 18244 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18245 | } |
| 18246 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18247 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 18248 | { |
| 18249 | alc262_hippo_automute(codec); |
| 18250 | alc_mic_automute(codec); |
| 18251 | } |
| 18252 | |
| 18253 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18254 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18255 | struct alc_spec *spec = codec->spec; |
| 18256 | |
| 18257 | spec->autocfg.hp_pins[0] = 0x14; |
| 18258 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18259 | } |
| 18260 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18261 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 18262 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18263 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 18264 | { |
| 18265 | unsigned int present; |
| 18266 | unsigned char bits; |
| 18267 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18268 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18269 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18270 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18271 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18272 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18273 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18274 | } |
| 18275 | |
| 18276 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 18277 | { |
| 18278 | unsigned int present; |
| 18279 | unsigned char bits; |
| 18280 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18281 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18282 | bits = present ? HDA_AMP_MUTE : 0; |
| 18283 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
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 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18286 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18287 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18288 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18289 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18290 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18291 | } |
| 18292 | |
| 18293 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18294 | { |
| 18295 | unsigned int present; |
| 18296 | unsigned char bits; |
| 18297 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18298 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18299 | bits = present ? HDA_AMP_MUTE : 0; |
| 18300 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18301 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18302 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18303 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18304 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18305 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18306 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18307 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18308 | } |
| 18309 | |
| 18310 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18311 | { |
| 18312 | unsigned int present; |
| 18313 | unsigned char bits; |
| 18314 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18315 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18316 | bits = present ? 0 : PIN_OUT; |
| 18317 | snd_hda_codec_write(codec, 0x14, 0, |
| 18318 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18319 | } |
| 18320 | |
| 18321 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18322 | { |
| 18323 | unsigned int present1, present2; |
| 18324 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18325 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18326 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18327 | |
| 18328 | if (present1 || present2) { |
| 18329 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18330 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18331 | } else { |
| 18332 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18333 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18334 | } |
| 18335 | } |
| 18336 | |
| 18337 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18338 | { |
| 18339 | unsigned int present1, present2; |
| 18340 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18341 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18342 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18343 | |
| 18344 | if (present1 || present2) { |
| 18345 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18346 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18347 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18348 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18349 | } else { |
| 18350 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18351 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18352 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18353 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18354 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18355 | } |
| 18356 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18357 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18358 | { |
| 18359 | unsigned int present1, present2; |
| 18360 | |
| 18361 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18362 | AC_VERB_GET_PIN_SENSE, 0) |
| 18363 | & AC_PINSENSE_PRESENCE; |
| 18364 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18365 | AC_VERB_GET_PIN_SENSE, 0) |
| 18366 | & AC_PINSENSE_PRESENCE; |
| 18367 | |
| 18368 | if (present1 || present2) { |
| 18369 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18370 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18371 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18372 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18373 | } else { |
| 18374 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18375 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18376 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18377 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18378 | } |
| 18379 | } |
| 18380 | |
| 18381 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18382 | { |
| 18383 | unsigned int present1, present2; |
| 18384 | |
| 18385 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18386 | AC_VERB_GET_PIN_SENSE, 0) |
| 18387 | & AC_PINSENSE_PRESENCE; |
| 18388 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18389 | AC_VERB_GET_PIN_SENSE, 0) |
| 18390 | & AC_PINSENSE_PRESENCE; |
| 18391 | |
| 18392 | if (present1 || present2) { |
| 18393 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18394 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18395 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18396 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18397 | } else { |
| 18398 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18399 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18400 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18401 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18402 | } |
| 18403 | } |
| 18404 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18405 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18406 | unsigned int res) |
| 18407 | { |
| 18408 | switch (res >> 26) { |
| 18409 | case ALC880_HP_EVENT: |
| 18410 | alc663_m51va_speaker_automute(codec); |
| 18411 | break; |
| 18412 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18413 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18414 | break; |
| 18415 | } |
| 18416 | } |
| 18417 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18418 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18419 | { |
| 18420 | struct alc_spec *spec = codec->spec; |
| 18421 | spec->ext_mic.pin = 0x18; |
| 18422 | spec->ext_mic.mux_idx = 0; |
| 18423 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18424 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18425 | spec->auto_mic = 1; |
| 18426 | } |
| 18427 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18428 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18429 | { |
| 18430 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18431 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18432 | } |
| 18433 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18434 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18435 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18436 | |
| 18437 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18438 | { |
| 18439 | struct alc_spec *spec = codec->spec; |
| 18440 | spec->ext_mic.pin = 0x18; |
| 18441 | spec->ext_mic.mux_idx = 0; |
| 18442 | spec->int_mic.pin = 0x19; |
| 18443 | spec->int_mic.mux_idx = 1; |
| 18444 | spec->auto_mic = 1; |
| 18445 | } |
| 18446 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18447 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18448 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18449 | /* ***************** Mode2 ******************************/ |
| 18450 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18451 | unsigned int res) |
| 18452 | { |
| 18453 | switch (res >> 26) { |
| 18454 | case ALC880_HP_EVENT: |
| 18455 | alc662_f5z_speaker_automute(codec); |
| 18456 | break; |
| 18457 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18458 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18459 | break; |
| 18460 | } |
| 18461 | } |
| 18462 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18463 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18464 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18465 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18466 | { |
| 18467 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18468 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18469 | } |
| 18470 | /* ***************** Mode3 ******************************/ |
| 18471 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18472 | unsigned int res) |
| 18473 | { |
| 18474 | switch (res >> 26) { |
| 18475 | case ALC880_HP_EVENT: |
| 18476 | alc663_two_hp_m1_speaker_automute(codec); |
| 18477 | break; |
| 18478 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18479 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18480 | break; |
| 18481 | } |
| 18482 | } |
| 18483 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18484 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18485 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18486 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18487 | { |
| 18488 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18489 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18490 | } |
| 18491 | /* ***************** Mode4 ******************************/ |
| 18492 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18493 | unsigned int res) |
| 18494 | { |
| 18495 | switch (res >> 26) { |
| 18496 | case ALC880_HP_EVENT: |
| 18497 | alc663_21jd_two_speaker_automute(codec); |
| 18498 | break; |
| 18499 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18500 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18501 | break; |
| 18502 | } |
| 18503 | } |
| 18504 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18505 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18506 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18507 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18508 | { |
| 18509 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18510 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18511 | } |
| 18512 | /* ***************** Mode5 ******************************/ |
| 18513 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18514 | unsigned int res) |
| 18515 | { |
| 18516 | switch (res >> 26) { |
| 18517 | case ALC880_HP_EVENT: |
| 18518 | alc663_15jd_two_speaker_automute(codec); |
| 18519 | break; |
| 18520 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18521 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18522 | break; |
| 18523 | } |
| 18524 | } |
| 18525 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18526 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18527 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18528 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18529 | { |
| 18530 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18531 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18532 | } |
| 18533 | /* ***************** Mode6 ******************************/ |
| 18534 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18535 | unsigned int res) |
| 18536 | { |
| 18537 | switch (res >> 26) { |
| 18538 | case ALC880_HP_EVENT: |
| 18539 | alc663_two_hp_m2_speaker_automute(codec); |
| 18540 | break; |
| 18541 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18542 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18543 | break; |
| 18544 | } |
| 18545 | } |
| 18546 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18547 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18548 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18549 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18550 | { |
| 18551 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18552 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18553 | } |
| 18554 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18555 | /* ***************** Mode7 ******************************/ |
| 18556 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18557 | unsigned int res) |
| 18558 | { |
| 18559 | switch (res >> 26) { |
| 18560 | case ALC880_HP_EVENT: |
| 18561 | alc663_two_hp_m7_speaker_automute(codec); |
| 18562 | break; |
| 18563 | case ALC880_MIC_EVENT: |
| 18564 | alc_mic_automute(codec); |
| 18565 | break; |
| 18566 | } |
| 18567 | } |
| 18568 | |
| 18569 | #define alc663_mode7_setup alc663_mode1_setup |
| 18570 | |
| 18571 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18572 | { |
| 18573 | alc663_two_hp_m7_speaker_automute(codec); |
| 18574 | alc_mic_automute(codec); |
| 18575 | } |
| 18576 | |
| 18577 | /* ***************** Mode8 ******************************/ |
| 18578 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18579 | unsigned int res) |
| 18580 | { |
| 18581 | switch (res >> 26) { |
| 18582 | case ALC880_HP_EVENT: |
| 18583 | alc663_two_hp_m8_speaker_automute(codec); |
| 18584 | break; |
| 18585 | case ALC880_MIC_EVENT: |
| 18586 | alc_mic_automute(codec); |
| 18587 | break; |
| 18588 | } |
| 18589 | } |
| 18590 | |
| 18591 | #define alc663_mode8_setup alc663_m51va_setup |
| 18592 | |
| 18593 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18594 | { |
| 18595 | alc663_two_hp_m8_speaker_automute(codec); |
| 18596 | alc_mic_automute(codec); |
| 18597 | } |
| 18598 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18599 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18600 | { |
| 18601 | unsigned int present; |
| 18602 | unsigned char bits; |
| 18603 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18604 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18605 | bits = present ? HDA_AMP_MUTE : 0; |
| 18606 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18607 | HDA_AMP_MUTE, bits); |
| 18608 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18609 | HDA_AMP_MUTE, bits); |
| 18610 | } |
| 18611 | |
| 18612 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18613 | { |
| 18614 | unsigned int present; |
| 18615 | unsigned char bits; |
| 18616 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18617 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18618 | bits = present ? HDA_AMP_MUTE : 0; |
| 18619 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18620 | HDA_AMP_MUTE, bits); |
| 18621 | } |
| 18622 | |
| 18623 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18624 | unsigned int res) |
| 18625 | { |
| 18626 | switch (res >> 26) { |
| 18627 | case ALC880_HP_EVENT: |
| 18628 | alc663_g71v_hp_automute(codec); |
| 18629 | break; |
| 18630 | case ALC880_FRONT_EVENT: |
| 18631 | alc663_g71v_front_automute(codec); |
| 18632 | break; |
| 18633 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18634 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18635 | break; |
| 18636 | } |
| 18637 | } |
| 18638 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18639 | #define alc663_g71v_setup alc663_m51va_setup |
| 18640 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18641 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18642 | { |
| 18643 | alc663_g71v_front_automute(codec); |
| 18644 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18645 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18646 | } |
| 18647 | |
| 18648 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18649 | unsigned int res) |
| 18650 | { |
| 18651 | switch (res >> 26) { |
| 18652 | case ALC880_HP_EVENT: |
| 18653 | alc663_m51va_speaker_automute(codec); |
| 18654 | break; |
| 18655 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18656 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18657 | break; |
| 18658 | } |
| 18659 | } |
| 18660 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18661 | #define alc663_g50v_setup alc663_m51va_setup |
| 18662 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18663 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18664 | { |
| 18665 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18666 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18667 | } |
| 18668 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18669 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18670 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18671 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18672 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18673 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18674 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18675 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18676 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18677 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18678 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18679 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18680 | { } /* end */ |
| 18681 | }; |
| 18682 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18683 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18684 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18685 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18686 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18687 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18688 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18689 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18692 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18693 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18694 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18695 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18696 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18697 | { } /* end */ |
| 18698 | }; |
| 18699 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18700 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18701 | #define alc662_loopbacks alc880_loopbacks |
| 18702 | #endif |
| 18703 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18704 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18705 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18706 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18707 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18708 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18709 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18710 | |
| 18711 | /* |
| 18712 | * configuration and preset |
| 18713 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18714 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18715 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18716 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18717 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18718 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18719 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18720 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18721 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18722 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18723 | [ALC663_ASUS_M51VA] = "m51va", |
| 18724 | [ALC663_ASUS_G71V] = "g71v", |
| 18725 | [ALC663_ASUS_H13] = "h13", |
| 18726 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18727 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18728 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18729 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18730 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18731 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18732 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18733 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18734 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18735 | [ALC272_DELL] = "dell", |
| 18736 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18737 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18738 | [ALC662_AUTO] = "auto", |
| 18739 | }; |
| 18740 | |
| 18741 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18742 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18743 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18744 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18745 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18746 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18747 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18748 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18749 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18750 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18751 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18752 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18753 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18754 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18755 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18756 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18757 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18758 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18759 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18760 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18761 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18762 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18763 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18764 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18765 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18766 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18767 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18768 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18769 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18770 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18771 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18772 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18773 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18774 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18775 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18776 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18777 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18778 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18779 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18780 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18781 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18782 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18783 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18784 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18785 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18786 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18787 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18788 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18789 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18790 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18791 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18792 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18793 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18794 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18795 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18796 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18797 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18798 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18799 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18800 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18801 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18802 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18803 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18804 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18805 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18806 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18807 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18808 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18809 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18810 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18811 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18812 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18813 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18814 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18815 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18816 | ALC663_ASUS_H13), |
Anisse Astier | 965b76d | 2011-02-10 13:14:44 +0100 | [diff] [blame] | 18817 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18818 | {} |
| 18819 | }; |
| 18820 | |
| 18821 | static struct alc_config_preset alc662_presets[] = { |
| 18822 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18823 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18824 | .init_verbs = { alc662_init_verbs }, |
| 18825 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18826 | .dac_nids = alc662_dac_nids, |
| 18827 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18828 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18829 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18830 | .channel_mode = alc662_3ST_2ch_modes, |
| 18831 | .input_mux = &alc662_capture_source, |
| 18832 | }, |
| 18833 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18834 | .mixers = { alc662_3ST_6ch_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_3ST_6ch_modes), |
| 18841 | .channel_mode = alc662_3ST_6ch_modes, |
| 18842 | .need_dac_fix = 1, |
| 18843 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18844 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18845 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18846 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18847 | .init_verbs = { alc662_init_verbs }, |
| 18848 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18849 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18850 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18851 | .channel_mode = alc662_3ST_6ch_modes, |
| 18852 | .need_dac_fix = 1, |
| 18853 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18854 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18855 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18856 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18857 | .init_verbs = { alc662_init_verbs }, |
| 18858 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18859 | .dac_nids = alc662_dac_nids, |
| 18860 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18861 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18862 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18863 | .channel_mode = alc662_5stack_modes, |
| 18864 | .input_mux = &alc662_capture_source, |
| 18865 | }, |
| 18866 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18867 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18868 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18869 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18870 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18871 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18872 | .channel_mode = alc662_3ST_2ch_modes, |
| 18873 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18874 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18875 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18876 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18877 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18878 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18879 | .init_verbs = { alc662_init_verbs, |
| 18880 | alc662_eeepc_sue_init_verbs }, |
| 18881 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18882 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18883 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18884 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18885 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18886 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18887 | .init_hook = alc662_eeepc_inithook, |
| 18888 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18889 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18890 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18891 | alc662_chmode_mixer }, |
| 18892 | .init_verbs = { alc662_init_verbs, |
| 18893 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18894 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18895 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18896 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18897 | .channel_mode = alc662_3ST_6ch_modes, |
| 18898 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18899 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18900 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18901 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18902 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18903 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18904 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18905 | .init_verbs = { alc662_init_verbs, |
| 18906 | alc662_ecs_init_verbs }, |
| 18907 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18908 | .dac_nids = alc662_dac_nids, |
| 18909 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18910 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18911 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18912 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18913 | .init_hook = alc662_eeepc_inithook, |
| 18914 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18915 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18916 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18917 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18918 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18919 | .dac_nids = alc662_dac_nids, |
| 18920 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18921 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18922 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18923 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18924 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18925 | .init_hook = alc663_m51va_inithook, |
| 18926 | }, |
| 18927 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18928 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18929 | .init_verbs = { alc662_init_verbs, alc663_g71v_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_2ch_modes), |
| 18934 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18935 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18936 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18937 | .init_hook = alc663_g71v_inithook, |
| 18938 | }, |
| 18939 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18940 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18941 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18942 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18943 | .dac_nids = alc662_dac_nids, |
| 18944 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18945 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18946 | .unsol_event = alc663_m51va_unsol_event, |
| 18947 | .init_hook = alc663_m51va_inithook, |
| 18948 | }, |
| 18949 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18950 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18951 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18952 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18953 | .dac_nids = alc662_dac_nids, |
| 18954 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18955 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18956 | .channel_mode = alc662_3ST_6ch_modes, |
| 18957 | .input_mux = &alc663_capture_source, |
| 18958 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18959 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18960 | .init_hook = alc663_g50v_inithook, |
| 18961 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18962 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18963 | .mixers = { alc663_m51va_mixer }, |
| 18964 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18965 | .init_verbs = { alc662_init_verbs, |
| 18966 | alc663_21jd_amic_init_verbs }, |
| 18967 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18968 | .hp_nid = 0x03, |
| 18969 | .dac_nids = alc662_dac_nids, |
| 18970 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18971 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18972 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18973 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18974 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18975 | .init_hook = alc663_mode1_inithook, |
| 18976 | }, |
| 18977 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18978 | .mixers = { alc662_1bjd_mixer }, |
| 18979 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18980 | .init_verbs = { alc662_init_verbs, |
| 18981 | alc662_1bjd_amic_init_verbs }, |
| 18982 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18983 | .dac_nids = alc662_dac_nids, |
| 18984 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18985 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18986 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18987 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18988 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18989 | .init_hook = alc662_mode2_inithook, |
| 18990 | }, |
| 18991 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18992 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18993 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18994 | .init_verbs = { alc662_init_verbs, |
| 18995 | alc663_two_hp_amic_m1_init_verbs }, |
| 18996 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18997 | .hp_nid = 0x03, |
| 18998 | .dac_nids = alc662_dac_nids, |
| 18999 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19000 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19001 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19002 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19003 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19004 | .init_hook = alc663_mode3_inithook, |
| 19005 | }, |
| 19006 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19007 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 19008 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19009 | .init_verbs = { alc662_init_verbs, |
| 19010 | alc663_21jd_amic_init_verbs}, |
| 19011 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19012 | .hp_nid = 0x03, |
| 19013 | .dac_nids = alc662_dac_nids, |
| 19014 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19015 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19016 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19017 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19018 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19019 | .init_hook = alc663_mode4_inithook, |
| 19020 | }, |
| 19021 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19022 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 19023 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19024 | .init_verbs = { alc662_init_verbs, |
| 19025 | alc663_15jd_amic_init_verbs }, |
| 19026 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19027 | .hp_nid = 0x03, |
| 19028 | .dac_nids = alc662_dac_nids, |
| 19029 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19030 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19031 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19032 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19033 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19034 | .init_hook = alc663_mode5_inithook, |
| 19035 | }, |
| 19036 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19037 | .mixers = { alc663_two_hp_m2_mixer }, |
| 19038 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19039 | .init_verbs = { alc662_init_verbs, |
| 19040 | alc663_two_hp_amic_m2_init_verbs }, |
| 19041 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19042 | .hp_nid = 0x03, |
| 19043 | .dac_nids = alc662_dac_nids, |
| 19044 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19045 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19046 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19047 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19048 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19049 | .init_hook = alc663_mode6_inithook, |
| 19050 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19051 | [ALC663_ASUS_MODE7] = { |
| 19052 | .mixers = { alc663_mode7_mixer }, |
| 19053 | .cap_mixer = alc662_auto_capture_mixer, |
| 19054 | .init_verbs = { alc662_init_verbs, |
| 19055 | alc663_mode7_init_verbs }, |
| 19056 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19057 | .hp_nid = 0x03, |
| 19058 | .dac_nids = alc662_dac_nids, |
| 19059 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19060 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19061 | .channel_mode = alc662_3ST_2ch_modes, |
| 19062 | .unsol_event = alc663_mode7_unsol_event, |
| 19063 | .setup = alc663_mode7_setup, |
| 19064 | .init_hook = alc663_mode7_inithook, |
| 19065 | }, |
| 19066 | [ALC663_ASUS_MODE8] = { |
| 19067 | .mixers = { alc663_mode8_mixer }, |
| 19068 | .cap_mixer = alc662_auto_capture_mixer, |
| 19069 | .init_verbs = { alc662_init_verbs, |
| 19070 | alc663_mode8_init_verbs }, |
| 19071 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19072 | .hp_nid = 0x03, |
| 19073 | .dac_nids = alc662_dac_nids, |
| 19074 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19075 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19076 | .channel_mode = alc662_3ST_2ch_modes, |
| 19077 | .unsol_event = alc663_mode8_unsol_event, |
| 19078 | .setup = alc663_mode8_setup, |
| 19079 | .init_hook = alc663_mode8_inithook, |
| 19080 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19081 | [ALC272_DELL] = { |
| 19082 | .mixers = { alc663_m51va_mixer }, |
| 19083 | .cap_mixer = alc272_auto_capture_mixer, |
| 19084 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 19085 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19086 | .dac_nids = alc662_dac_nids, |
| 19087 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19088 | .adc_nids = alc272_adc_nids, |
| 19089 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 19090 | .capsrc_nids = alc272_capsrc_nids, |
| 19091 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19092 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19093 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19094 | .init_hook = alc663_m51va_inithook, |
| 19095 | }, |
| 19096 | [ALC272_DELL_ZM1] = { |
| 19097 | .mixers = { alc663_m51va_mixer }, |
| 19098 | .cap_mixer = alc662_auto_capture_mixer, |
| 19099 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 19100 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19101 | .dac_nids = alc662_dac_nids, |
| 19102 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19103 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19104 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19105 | .capsrc_nids = alc662_capsrc_nids, |
| 19106 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19107 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19108 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19109 | .init_hook = alc663_m51va_inithook, |
| 19110 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19111 | [ALC272_SAMSUNG_NC10] = { |
| 19112 | .mixers = { alc272_nc10_mixer }, |
| 19113 | .init_verbs = { alc662_init_verbs, |
| 19114 | alc663_21jd_amic_init_verbs }, |
| 19115 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19116 | .dac_nids = alc272_dac_nids, |
| 19117 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19118 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19119 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19120 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19121 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19122 | .init_hook = alc663_mode4_inithook, |
| 19123 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19124 | }; |
| 19125 | |
| 19126 | |
| 19127 | /* |
| 19128 | * BIOS auto configuration |
| 19129 | */ |
| 19130 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19131 | /* convert from MIX nid to DAC */ |
| 19132 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 19133 | { |
| 19134 | if (nid == 0x0f) |
| 19135 | return 0x02; |
| 19136 | else if (nid >= 0x0c && nid <= 0x0e) |
| 19137 | return nid - 0x0c + 0x02; |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19138 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ |
| 19139 | return 0x25; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19140 | else |
| 19141 | return 0; |
| 19142 | } |
| 19143 | |
| 19144 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 19145 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 19146 | hda_nid_t dac) |
| 19147 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19148 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19149 | int i, num; |
| 19150 | |
| 19151 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 19152 | for (i = 0; i < num; i++) { |
| 19153 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 19154 | return mix[i]; |
| 19155 | } |
| 19156 | return 0; |
| 19157 | } |
| 19158 | |
| 19159 | /* look for an empty DAC slot */ |
| 19160 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 19161 | { |
| 19162 | struct alc_spec *spec = codec->spec; |
| 19163 | hda_nid_t srcs[5]; |
| 19164 | int i, j, num; |
| 19165 | |
| 19166 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 19167 | if (num < 0) |
| 19168 | return 0; |
| 19169 | for (i = 0; i < num; i++) { |
| 19170 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 19171 | if (!nid) |
| 19172 | continue; |
| 19173 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 19174 | if (spec->multiout.dac_nids[j] == nid) |
| 19175 | break; |
| 19176 | if (j >= spec->multiout.num_dacs) |
| 19177 | return nid; |
| 19178 | } |
| 19179 | return 0; |
| 19180 | } |
| 19181 | |
| 19182 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 19183 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 19184 | const struct auto_pin_cfg *cfg) |
| 19185 | { |
| 19186 | struct alc_spec *spec = codec->spec; |
| 19187 | int i; |
| 19188 | hda_nid_t dac; |
| 19189 | |
| 19190 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19191 | for (i = 0; i < cfg->line_outs; i++) { |
| 19192 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 19193 | if (!dac) |
| 19194 | continue; |
| 19195 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19196 | } |
| 19197 | return 0; |
| 19198 | } |
| 19199 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19200 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 19201 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19202 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19203 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19204 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 19205 | } |
| 19206 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19207 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 19208 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19209 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19210 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19211 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19212 | } |
| 19213 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19214 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 19215 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 19216 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 19217 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19218 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19219 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19220 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19221 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19222 | |
| 19223 | /* add playback controls from the parsed DAC table */ |
| 19224 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19225 | const struct auto_pin_cfg *cfg) |
| 19226 | { |
| 19227 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19228 | static const char * const chname[4] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19229 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19230 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19231 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19232 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19233 | int i, err; |
| 19234 | |
| 19235 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19236 | nid = spec->multiout.dac_nids[i]; |
| 19237 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19238 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19239 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 19240 | if (!mix) |
| 19241 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19242 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19243 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19244 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19245 | if (err < 0) |
| 19246 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19247 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19248 | if (err < 0) |
| 19249 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19250 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19251 | if (err < 0) |
| 19252 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19253 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19254 | if (err < 0) |
| 19255 | return err; |
| 19256 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19257 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 19258 | int index = i; |
| 19259 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19260 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 19261 | index = 0; |
| 19262 | } |
| 19263 | err = __alc662_add_vol_ctl(spec, name, nid, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19264 | if (err < 0) |
| 19265 | return err; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 19266 | err = __alc662_add_sw_ctl(spec, name, mix, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19267 | if (err < 0) |
| 19268 | return err; |
| 19269 | } |
| 19270 | } |
| 19271 | return 0; |
| 19272 | } |
| 19273 | |
| 19274 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19275 | /* return DAC nid if any new DAC is assigned */ |
| 19276 | 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] | 19277 | const char *pfx) |
| 19278 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19279 | struct alc_spec *spec = codec->spec; |
| 19280 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19281 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19282 | |
| 19283 | if (!pin) |
| 19284 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19285 | nid = alc662_look_for_dac(codec, pin); |
| 19286 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19287 | /* the corresponding DAC is already occupied */ |
| 19288 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19289 | return 0; /* no way */ |
| 19290 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19291 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19292 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19293 | } |
| 19294 | |
| 19295 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19296 | if (!mix) |
| 19297 | return 0; |
| 19298 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19299 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19300 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19301 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19302 | if (err < 0) |
| 19303 | return err; |
| 19304 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19305 | } |
| 19306 | |
| 19307 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19308 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19309 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19310 | |
| 19311 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19312 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19313 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19314 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19315 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19316 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19317 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19318 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19319 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19320 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19321 | if (num <= 1) |
| 19322 | return; |
| 19323 | for (i = 0; i < num; i++) { |
| 19324 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19325 | continue; |
| 19326 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19327 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19328 | } |
| 19329 | } |
| 19330 | |
| 19331 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19332 | { |
| 19333 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19334 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19335 | int i; |
| 19336 | |
| 19337 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19338 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19339 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19340 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19341 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19342 | } |
| 19343 | } |
| 19344 | |
| 19345 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19346 | { |
| 19347 | struct alc_spec *spec = codec->spec; |
| 19348 | hda_nid_t pin; |
| 19349 | |
| 19350 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19351 | if (pin) |
| 19352 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19353 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19354 | pin = spec->autocfg.speaker_pins[0]; |
| 19355 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19356 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19357 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19358 | } |
| 19359 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19360 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19361 | |
| 19362 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19363 | { |
| 19364 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19365 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19366 | int i; |
| 19367 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19368 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19369 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19370 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19371 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19372 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19373 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19374 | snd_hda_codec_write(codec, nid, 0, |
| 19375 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19376 | AMP_OUT_MUTE); |
| 19377 | } |
| 19378 | } |
| 19379 | } |
| 19380 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19381 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19382 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19383 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19384 | { |
| 19385 | struct alc_spec *spec = codec->spec; |
| 19386 | int err; |
| 19387 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19388 | |
| 19389 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19390 | alc662_ignore); |
| 19391 | if (err < 0) |
| 19392 | return err; |
| 19393 | if (!spec->autocfg.line_outs) |
| 19394 | return 0; /* can't find valid BIOS pin config */ |
| 19395 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19396 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19397 | if (err < 0) |
| 19398 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19399 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19400 | if (err < 0) |
| 19401 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19402 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19403 | spec->autocfg.speaker_pins[0], |
| 19404 | "Speaker"); |
| 19405 | if (err < 0) |
| 19406 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19407 | if (err) |
| 19408 | spec->multiout.extra_out_nid[0] = err; |
| 19409 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19410 | "Headphone"); |
| 19411 | if (err < 0) |
| 19412 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19413 | if (err) |
| 19414 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19415 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19416 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19417 | return err; |
| 19418 | |
| 19419 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19420 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19421 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19422 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19423 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19424 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19425 | |
| 19426 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19427 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19428 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19429 | add_verb(spec, alc662_init_verbs); |
| 19430 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19431 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19432 | add_verb(spec, alc663_init_verbs); |
| 19433 | |
| 19434 | if (codec->vendor_id == 0x10ec0272) |
| 19435 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19436 | |
| 19437 | err = alc_auto_add_mic_boost(codec); |
| 19438 | if (err < 0) |
| 19439 | return err; |
| 19440 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19441 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19442 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19443 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19444 | else |
| 19445 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19446 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19447 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19448 | } |
| 19449 | |
| 19450 | /* additional initialization for auto-configuration model */ |
| 19451 | static void alc662_auto_init(struct hda_codec *codec) |
| 19452 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19453 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19454 | alc662_auto_init_multi_out(codec); |
| 19455 | alc662_auto_init_hp_out(codec); |
| 19456 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19457 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19458 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19459 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19460 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19461 | } |
| 19462 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19463 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19464 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19465 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19466 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19467 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19468 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19469 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19470 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19471 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19472 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19473 | printk(KERN_WARNING |
| 19474 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19475 | } |
| 19476 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19477 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19478 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19479 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19480 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19481 | ALC662_FIXUP_CZC_P10T, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19482 | ALC662_FIXUP_GIGABYTE, |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame^] | 19483 | ALC662_FIXUP_SKU_IGNORE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19484 | }; |
| 19485 | |
| 19486 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19487 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19488 | .type = ALC_FIXUP_PINS, |
| 19489 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19490 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19491 | { } |
| 19492 | } |
| 19493 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19494 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19495 | .type = ALC_FIXUP_PINS, |
| 19496 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19497 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19498 | { } |
| 19499 | } |
| 19500 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19501 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19502 | .type = ALC_FIXUP_FUNC, |
| 19503 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19504 | }, |
| 19505 | [ALC662_FIXUP_CZC_P10T] = { |
| 19506 | .type = ALC_FIXUP_VERBS, |
| 19507 | .v.verbs = (const struct hda_verb[]) { |
| 19508 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19509 | {} |
| 19510 | } |
| 19511 | }, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19512 | [ALC662_FIXUP_GIGABYTE] = { |
| 19513 | .type = ALC_FIXUP_PINS, |
| 19514 | .v.pins = (const struct alc_pincfg[]) { |
| 19515 | { 0x14, 0x1114410 }, /* set as speaker */ |
| 19516 | { } |
| 19517 | } |
| 19518 | }, |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame^] | 19519 | [ALC662_FIXUP_SKU_IGNORE] = { |
| 19520 | .type = ALC_FIXUP_SKU, |
| 19521 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
| 19522 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19523 | }; |
| 19524 | |
| 19525 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 19526 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame^] | 19527 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19528 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19529 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19530 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", ALC662_FIXUP_GIGABYTE), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19531 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19532 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19533 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19534 | {} |
| 19535 | }; |
| 19536 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19537 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19538 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19539 | {} |
| 19540 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19541 | |
| 19542 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19543 | static int patch_alc662(struct hda_codec *codec) |
| 19544 | { |
| 19545 | struct alc_spec *spec; |
| 19546 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19547 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19548 | |
| 19549 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19550 | if (!spec) |
| 19551 | return -ENOMEM; |
| 19552 | |
| 19553 | codec->spec = spec; |
| 19554 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19555 | alc_auto_parse_customize_define(codec); |
| 19556 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19557 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19558 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19559 | coef = alc_read_coef_idx(codec, 0); |
| 19560 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19561 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19562 | else if (coef & (1 << 14) && |
| 19563 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19564 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19565 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19566 | else if (coef == 0x4011) |
| 19567 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19568 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19569 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19570 | alc662_models, |
| 19571 | alc662_cfg_tbl); |
| 19572 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19573 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19574 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19575 | board_config = ALC662_AUTO; |
| 19576 | } |
| 19577 | |
| 19578 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19579 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19580 | alc662_fixup_tbl, alc662_fixups); |
| 19581 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19582 | /* automatic parse from the BIOS config */ |
| 19583 | err = alc662_parse_auto_config(codec); |
| 19584 | if (err < 0) { |
| 19585 | alc_free(codec); |
| 19586 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19587 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19588 | printk(KERN_INFO |
| 19589 | "hda_codec: Cannot set up configuration " |
| 19590 | "from BIOS. Using base mode...\n"); |
| 19591 | board_config = ALC662_3ST_2ch_DIG; |
| 19592 | } |
| 19593 | } |
| 19594 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19595 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19596 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19597 | if (err < 0) { |
| 19598 | alc_free(codec); |
| 19599 | return err; |
| 19600 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19601 | } |
| 19602 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19603 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19604 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19605 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19606 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19607 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19608 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19609 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19610 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19611 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19612 | if (!spec->adc_nids) { |
| 19613 | spec->adc_nids = alc662_adc_nids; |
| 19614 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19615 | } |
| 19616 | if (!spec->capsrc_nids) |
| 19617 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19618 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19619 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19620 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19621 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19622 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19623 | switch (codec->vendor_id) { |
| 19624 | case 0x10ec0662: |
| 19625 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19626 | break; |
| 19627 | case 0x10ec0272: |
| 19628 | case 0x10ec0663: |
| 19629 | case 0x10ec0665: |
| 19630 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19631 | break; |
| 19632 | case 0x10ec0273: |
| 19633 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19634 | break; |
| 19635 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19636 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19637 | spec->vmaster_nid = 0x02; |
| 19638 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19639 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19640 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19641 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19642 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19643 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19644 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19645 | alc_init_jacks(codec); |
| 19646 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19647 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19648 | if (!spec->loopback.amplist) |
| 19649 | spec->loopback.amplist = alc662_loopbacks; |
| 19650 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19651 | |
| 19652 | return 0; |
| 19653 | } |
| 19654 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19655 | static int patch_alc888(struct hda_codec *codec) |
| 19656 | { |
| 19657 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19658 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19659 | if (codec->vendor_id == 0x10ec0887) |
| 19660 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19661 | else |
| 19662 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19663 | if (!codec->chip_name) { |
| 19664 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19665 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19666 | } |
| 19667 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19668 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19669 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19670 | } |
| 19671 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19672 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19673 | * ALC680 support |
| 19674 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19675 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19676 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19677 | #define alc680_modes alc260_modes |
| 19678 | |
| 19679 | static hda_nid_t alc680_dac_nids[3] = { |
| 19680 | /* Lout1, Lout2, hp */ |
| 19681 | 0x02, 0x03, 0x04 |
| 19682 | }; |
| 19683 | |
| 19684 | static hda_nid_t alc680_adc_nids[3] = { |
| 19685 | /* ADC0-2 */ |
| 19686 | /* DMIC, MIC, Line-in*/ |
| 19687 | 0x07, 0x08, 0x09 |
| 19688 | }; |
| 19689 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19690 | /* |
| 19691 | * Analog capture ADC cgange |
| 19692 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19693 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19694 | { |
| 19695 | struct alc_spec *spec = codec->spec; |
| 19696 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19697 | int pin_found = 0; |
| 19698 | int type_found = AUTO_PIN_LAST; |
| 19699 | hda_nid_t nid; |
| 19700 | int i; |
| 19701 | |
| 19702 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19703 | nid = cfg->inputs[i].pin; |
| 19704 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19705 | AC_PINCAP_PRES_DETECT)) |
| 19706 | continue; |
| 19707 | if (snd_hda_jack_detect(codec, nid)) { |
| 19708 | if (cfg->inputs[i].type < type_found) { |
| 19709 | type_found = cfg->inputs[i].type; |
| 19710 | pin_found = nid; |
| 19711 | } |
| 19712 | } |
| 19713 | } |
| 19714 | |
| 19715 | nid = 0x07; |
| 19716 | if (pin_found) |
| 19717 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19718 | |
| 19719 | if (nid != spec->cur_adc) |
| 19720 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19721 | spec->cur_adc = nid; |
| 19722 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19723 | spec->cur_adc_format); |
| 19724 | } |
| 19725 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19726 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19727 | struct hda_codec *codec, |
| 19728 | unsigned int stream_tag, |
| 19729 | unsigned int format, |
| 19730 | struct snd_pcm_substream *substream) |
| 19731 | { |
| 19732 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19733 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19734 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19735 | spec->cur_adc_stream_tag = stream_tag; |
| 19736 | spec->cur_adc_format = format; |
| 19737 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19738 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19739 | return 0; |
| 19740 | } |
| 19741 | |
| 19742 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19743 | struct hda_codec *codec, |
| 19744 | struct snd_pcm_substream *substream) |
| 19745 | { |
| 19746 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19747 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19748 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19749 | return 0; |
| 19750 | } |
| 19751 | |
| 19752 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19753 | .substreams = 1, /* can be overridden */ |
| 19754 | .channels_min = 2, |
| 19755 | .channels_max = 2, |
| 19756 | /* NID is set in alc_build_pcms */ |
| 19757 | .ops = { |
| 19758 | .prepare = alc680_capture_pcm_prepare, |
| 19759 | .cleanup = alc680_capture_pcm_cleanup |
| 19760 | }, |
| 19761 | }; |
| 19762 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19763 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19764 | /* output mixer control */ |
| 19765 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19766 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19767 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19768 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19769 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19770 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19771 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19772 | { } |
| 19773 | }; |
| 19774 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19775 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19776 | .ops = &snd_hda_bind_vol, |
| 19777 | .values = { |
| 19778 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19779 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19780 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19781 | 0 |
| 19782 | }, |
| 19783 | }; |
| 19784 | |
| 19785 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19786 | .ops = &snd_hda_bind_sw, |
| 19787 | .values = { |
| 19788 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19789 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19790 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19791 | 0 |
| 19792 | }, |
| 19793 | }; |
| 19794 | |
| 19795 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19796 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19797 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19798 | { } /* end */ |
| 19799 | }; |
| 19800 | |
| 19801 | /* |
| 19802 | * generic initialization of ADC, input mixers and output mixers |
| 19803 | */ |
| 19804 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19805 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19806 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19807 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19808 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19809 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19810 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19811 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19812 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19813 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19814 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19815 | |
| 19816 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19817 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19818 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19819 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19820 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19821 | |
| 19822 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19823 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19824 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19825 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19826 | { } |
| 19827 | }; |
| 19828 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19829 | /* toggle speaker-output according to the hp-jack state */ |
| 19830 | static void alc680_base_setup(struct hda_codec *codec) |
| 19831 | { |
| 19832 | struct alc_spec *spec = codec->spec; |
| 19833 | |
| 19834 | spec->autocfg.hp_pins[0] = 0x16; |
| 19835 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19836 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19837 | spec->autocfg.num_inputs = 2; |
| 19838 | spec->autocfg.inputs[0].pin = 0x18; |
| 19839 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19840 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19841 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19842 | } |
| 19843 | |
| 19844 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19845 | unsigned int res) |
| 19846 | { |
| 19847 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19848 | alc_automute_amp(codec); |
| 19849 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19850 | alc680_rec_autoswitch(codec); |
| 19851 | } |
| 19852 | |
| 19853 | static void alc680_inithook(struct hda_codec *codec) |
| 19854 | { |
| 19855 | alc_automute_amp(codec); |
| 19856 | alc680_rec_autoswitch(codec); |
| 19857 | } |
| 19858 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19859 | /* create input playback/capture controls for the given pin */ |
| 19860 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19861 | const char *ctlname, int idx) |
| 19862 | { |
| 19863 | hda_nid_t dac; |
| 19864 | int err; |
| 19865 | |
| 19866 | switch (nid) { |
| 19867 | case 0x14: |
| 19868 | dac = 0x02; |
| 19869 | break; |
| 19870 | case 0x15: |
| 19871 | dac = 0x03; |
| 19872 | break; |
| 19873 | case 0x16: |
| 19874 | dac = 0x04; |
| 19875 | break; |
| 19876 | default: |
| 19877 | return 0; |
| 19878 | } |
| 19879 | if (spec->multiout.dac_nids[0] != dac && |
| 19880 | spec->multiout.dac_nids[1] != dac) { |
| 19881 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19882 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19883 | HDA_OUTPUT)); |
| 19884 | if (err < 0) |
| 19885 | return err; |
| 19886 | |
| 19887 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19888 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19889 | |
| 19890 | if (err < 0) |
| 19891 | return err; |
| 19892 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19893 | } |
| 19894 | |
| 19895 | return 0; |
| 19896 | } |
| 19897 | |
| 19898 | /* add playback controls from the parsed DAC table */ |
| 19899 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19900 | const struct auto_pin_cfg *cfg) |
| 19901 | { |
| 19902 | hda_nid_t nid; |
| 19903 | int err; |
| 19904 | |
| 19905 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19906 | |
| 19907 | nid = cfg->line_out_pins[0]; |
| 19908 | if (nid) { |
| 19909 | const char *name; |
| 19910 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19911 | name = "Speaker"; |
| 19912 | else |
| 19913 | name = "Front"; |
| 19914 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19915 | if (err < 0) |
| 19916 | return err; |
| 19917 | } |
| 19918 | |
| 19919 | nid = cfg->speaker_pins[0]; |
| 19920 | if (nid) { |
| 19921 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19922 | if (err < 0) |
| 19923 | return err; |
| 19924 | } |
| 19925 | nid = cfg->hp_pins[0]; |
| 19926 | if (nid) { |
| 19927 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19928 | if (err < 0) |
| 19929 | return err; |
| 19930 | } |
| 19931 | |
| 19932 | return 0; |
| 19933 | } |
| 19934 | |
| 19935 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19936 | hda_nid_t nid, int pin_type) |
| 19937 | { |
| 19938 | alc_set_pin_output(codec, nid, pin_type); |
| 19939 | } |
| 19940 | |
| 19941 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19942 | { |
| 19943 | struct alc_spec *spec = codec->spec; |
| 19944 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19945 | if (nid) { |
| 19946 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19947 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19948 | } |
| 19949 | } |
| 19950 | |
| 19951 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19952 | { |
| 19953 | struct alc_spec *spec = codec->spec; |
| 19954 | hda_nid_t pin; |
| 19955 | |
| 19956 | pin = spec->autocfg.hp_pins[0]; |
| 19957 | if (pin) |
| 19958 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19959 | pin = spec->autocfg.speaker_pins[0]; |
| 19960 | if (pin) |
| 19961 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19962 | } |
| 19963 | |
| 19964 | /* pcm configuration: identical with ALC880 */ |
| 19965 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19966 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19967 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19968 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19969 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19970 | |
| 19971 | /* |
| 19972 | * BIOS auto configuration |
| 19973 | */ |
| 19974 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19975 | { |
| 19976 | struct alc_spec *spec = codec->spec; |
| 19977 | int err; |
| 19978 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19979 | |
| 19980 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19981 | alc680_ignore); |
| 19982 | if (err < 0) |
| 19983 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19984 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19985 | if (!spec->autocfg.line_outs) { |
| 19986 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19987 | spec->multiout.max_channels = 2; |
| 19988 | spec->no_analog = 1; |
| 19989 | goto dig_only; |
| 19990 | } |
| 19991 | return 0; /* can't find valid BIOS pin config */ |
| 19992 | } |
| 19993 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19994 | if (err < 0) |
| 19995 | return err; |
| 19996 | |
| 19997 | spec->multiout.max_channels = 2; |
| 19998 | |
| 19999 | dig_only: |
| 20000 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 20001 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20002 | if (spec->kctls.list) |
| 20003 | add_mixer(spec, spec->kctls.list); |
| 20004 | |
| 20005 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20006 | |
| 20007 | err = alc_auto_add_mic_boost(codec); |
| 20008 | if (err < 0) |
| 20009 | return err; |
| 20010 | |
| 20011 | return 1; |
| 20012 | } |
| 20013 | |
| 20014 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 20015 | |
| 20016 | /* init callback for auto-configuration model -- overriding the default init */ |
| 20017 | static void alc680_auto_init(struct hda_codec *codec) |
| 20018 | { |
| 20019 | struct alc_spec *spec = codec->spec; |
| 20020 | alc680_auto_init_multi_out(codec); |
| 20021 | alc680_auto_init_hp_out(codec); |
| 20022 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 20023 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20024 | if (spec->unsol_event) |
| 20025 | alc_inithook(codec); |
| 20026 | } |
| 20027 | |
| 20028 | /* |
| 20029 | * configuration and preset |
| 20030 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 20031 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 20032 | [ALC680_BASE] = "base", |
| 20033 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20034 | }; |
| 20035 | |
| 20036 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 20037 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 20038 | {} |
| 20039 | }; |
| 20040 | |
| 20041 | static struct alc_config_preset alc680_presets[] = { |
| 20042 | [ALC680_BASE] = { |
| 20043 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20044 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20045 | .init_verbs = { alc680_init_verbs }, |
| 20046 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 20047 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20048 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 20049 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 20050 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20051 | .unsol_event = alc680_unsol_event, |
| 20052 | .setup = alc680_base_setup, |
| 20053 | .init_hook = alc680_inithook, |
| 20054 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20055 | }, |
| 20056 | }; |
| 20057 | |
| 20058 | static int patch_alc680(struct hda_codec *codec) |
| 20059 | { |
| 20060 | struct alc_spec *spec; |
| 20061 | int board_config; |
| 20062 | int err; |
| 20063 | |
| 20064 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 20065 | if (spec == NULL) |
| 20066 | return -ENOMEM; |
| 20067 | |
| 20068 | codec->spec = spec; |
| 20069 | |
| 20070 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 20071 | alc680_models, |
| 20072 | alc680_cfg_tbl); |
| 20073 | |
| 20074 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 20075 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 20076 | codec->chip_name); |
| 20077 | board_config = ALC680_AUTO; |
| 20078 | } |
| 20079 | |
| 20080 | if (board_config == ALC680_AUTO) { |
| 20081 | /* automatic parse from the BIOS config */ |
| 20082 | err = alc680_parse_auto_config(codec); |
| 20083 | if (err < 0) { |
| 20084 | alc_free(codec); |
| 20085 | return err; |
| 20086 | } else if (!err) { |
| 20087 | printk(KERN_INFO |
| 20088 | "hda_codec: Cannot set up configuration " |
| 20089 | "from BIOS. Using base mode...\n"); |
| 20090 | board_config = ALC680_BASE; |
| 20091 | } |
| 20092 | } |
| 20093 | |
| 20094 | if (board_config != ALC680_AUTO) |
| 20095 | setup_preset(codec, &alc680_presets[board_config]); |
| 20096 | |
| 20097 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20098 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20099 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20100 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20101 | |
| 20102 | if (!spec->adc_nids) { |
| 20103 | spec->adc_nids = alc680_adc_nids; |
| 20104 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 20105 | } |
| 20106 | |
| 20107 | if (!spec->cap_mixer) |
| 20108 | set_capture_mixer(codec); |
| 20109 | |
| 20110 | spec->vmaster_nid = 0x02; |
| 20111 | |
| 20112 | codec->patch_ops = alc_patch_ops; |
| 20113 | if (board_config == ALC680_AUTO) |
| 20114 | spec->init_hook = alc680_auto_init; |
| 20115 | |
| 20116 | return 0; |
| 20117 | } |
| 20118 | |
| 20119 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20120 | * patch entries |
| 20121 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20122 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20123 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20124 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20125 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 20126 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20127 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20128 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 20129 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20130 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20131 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20132 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20133 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 20134 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 20135 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20136 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20137 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20138 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 20139 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 20140 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 20141 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 20142 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20143 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20144 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20145 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20146 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 20147 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20148 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 20149 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20150 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20151 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 20152 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 20153 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20154 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20155 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20156 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20157 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20158 | {} /* terminator */ |
| 20159 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20160 | |
| 20161 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 20162 | |
| 20163 | MODULE_LICENSE("GPL"); |
| 20164 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 20165 | |
| 20166 | static struct hda_codec_preset_list realtek_list = { |
| 20167 | .preset = snd_hda_preset_realtek, |
| 20168 | .owner = THIS_MODULE, |
| 20169 | }; |
| 20170 | |
| 20171 | static int __init patch_realtek_init(void) |
| 20172 | { |
| 20173 | return snd_hda_add_codec_preset(&realtek_list); |
| 20174 | } |
| 20175 | |
| 20176 | static void __exit patch_realtek_exit(void) |
| 20177 | { |
| 20178 | snd_hda_delete_codec_preset(&realtek_list); |
| 20179 | } |
| 20180 | |
| 20181 | module_init(patch_realtek_init) |
| 20182 | module_exit(patch_realtek_exit) |