Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 31 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 34 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 36 | #define ALC880_FRONT_EVENT 0x01 |
| 37 | #define ALC880_DCVOL_EVENT 0x02 |
| 38 | #define ALC880_HP_EVENT 0x04 |
| 39 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* ALC880 board config type */ |
| 42 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | ALC880_3ST, |
| 44 | ALC880_3ST_DIG, |
| 45 | ALC880_5ST, |
| 46 | ALC880_5ST_DIG, |
| 47 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 48 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 49 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 50 | ALC880_6ST_DIG, |
| 51 | ALC880_F1734, |
| 52 | ALC880_ASUS, |
| 53 | ALC880_ASUS_DIG, |
| 54 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 55 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 56 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 58 | ALC880_UNIWILL, |
| 59 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 60 | ALC880_CLEVO, |
| 61 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 62 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 63 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 64 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_SND_DEBUG |
| 66 | ALC880_TEST, |
| 67 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 68 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 69 | ALC880_MODEL_LAST /* last tag */ |
| 70 | }; |
| 71 | |
| 72 | /* ALC260 models */ |
| 73 | enum { |
| 74 | ALC260_BASIC, |
| 75 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 76 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 77 | ALC260_HP_3013, |
| 78 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 79 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 80 | ALC260_WILL, |
| 81 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 82 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 83 | #ifdef CONFIG_SND_DEBUG |
| 84 | ALC260_TEST, |
| 85 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 87 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 90 | /* ALC262 models */ |
| 91 | enum { |
| 92 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 93 | ALC262_HIPPO, |
| 94 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 95 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 96 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 97 | ALC262_HP_BPC_D7000_WL, |
| 98 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 99 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 100 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 101 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 102 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 103 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 104 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 105 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 106 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 108 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 109 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 110 | ALC262_AUTO, |
| 111 | ALC262_MODEL_LAST /* last tag */ |
| 112 | }; |
| 113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | /* ALC268 models */ |
| 115 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 116 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 117 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 118 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 119 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 120 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 121 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 122 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 123 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 124 | #ifdef CONFIG_SND_DEBUG |
| 125 | ALC268_TEST, |
| 126 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 127 | ALC268_AUTO, |
| 128 | ALC268_MODEL_LAST /* last tag */ |
| 129 | }; |
| 130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | /* ALC269 models */ |
| 132 | enum { |
| 133 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 134 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 135 | ALC269_AMIC, |
| 136 | ALC269_DMIC, |
| 137 | ALC269VB_AMIC, |
| 138 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 139 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 140 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 141 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 142 | ALC269_AUTO, |
| 143 | ALC269_MODEL_LAST /* last tag */ |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC861 models */ |
| 147 | enum { |
| 148 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 149 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_3ST_DIG, |
| 151 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 152 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 153 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 154 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 155 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC861_AUTO, |
| 157 | ALC861_MODEL_LAST, |
| 158 | }; |
| 159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | /* ALC861-VD models */ |
| 161 | enum { |
| 162 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 163 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 164 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_3ST, |
| 166 | ALC861VD_3ST_DIG, |
| 167 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 168 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 170 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 171 | ALC861VD_AUTO, |
| 172 | ALC861VD_MODEL_LAST, |
| 173 | }; |
| 174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | /* ALC662 models */ |
| 176 | enum { |
| 177 | ALC662_3ST_2ch_DIG, |
| 178 | ALC662_3ST_6ch_DIG, |
| 179 | ALC662_3ST_6ch, |
| 180 | ALC662_5ST_DIG, |
| 181 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 183 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 184 | ALC663_ASUS_M51VA, |
| 185 | ALC663_ASUS_G71V, |
| 186 | ALC663_ASUS_H13, |
| 187 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 188 | ALC662_ECS, |
| 189 | ALC663_ASUS_MODE1, |
| 190 | ALC662_ASUS_MODE2, |
| 191 | ALC663_ASUS_MODE3, |
| 192 | ALC663_ASUS_MODE4, |
| 193 | ALC663_ASUS_MODE5, |
| 194 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 195 | ALC663_ASUS_MODE7, |
| 196 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 197 | ALC272_DELL, |
| 198 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 199 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 200 | ALC662_AUTO, |
| 201 | ALC662_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* ALC882 models */ |
| 205 | enum { |
| 206 | ALC882_3ST_DIG, |
| 207 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 208 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 209 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC882_TARGA, |
| 211 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 212 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 213 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 214 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 215 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 216 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 217 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 218 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 219 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | ALC883_3ST_2ch_DIG, |
| 221 | ALC883_3ST_6ch_DIG, |
| 222 | ALC883_3ST_6ch, |
| 223 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 224 | ALC883_TARGA_DIG, |
| 225 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 226 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 285 | struct alc_jack { |
| 286 | hda_nid_t nid; |
| 287 | int type; |
| 288 | struct snd_jack *jack; |
| 289 | }; |
| 290 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 291 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 292 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 293 | struct alc_customize_define { |
| 294 | unsigned int sku_cfg; |
| 295 | unsigned char port_connectivity; |
| 296 | unsigned char check_sum; |
| 297 | unsigned char customization; |
| 298 | unsigned char external_amp; |
| 299 | unsigned int enable_pcbeep:1; |
| 300 | unsigned int platform_type:1; |
| 301 | unsigned int swap:1; |
| 302 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 303 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 304 | }; |
| 305 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | struct alc_spec { |
| 307 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 308 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 310 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 311 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 313 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 314 | * don't forget NULL |
| 315 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 316 | */ |
| 317 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 319 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | struct hda_pcm_stream *stream_analog_playback; |
| 321 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 322 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 323 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 325 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | struct hda_pcm_stream *stream_digital_playback; |
| 327 | struct hda_pcm_stream *stream_digital_capture; |
| 328 | |
| 329 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 330 | struct hda_multi_out multiout; /* playback set-up |
| 331 | * max_channels, dacs must be set |
| 332 | * dig_out_nid and hp_nid are optional |
| 333 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 334 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 335 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 336 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | |
| 338 | /* capture */ |
| 339 | unsigned int num_adc_nids; |
| 340 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 341 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 342 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 344 | /* capture setup for dynamic dual-adc switch */ |
| 345 | unsigned int cur_adc_idx; |
| 346 | hda_nid_t cur_adc; |
| 347 | unsigned int cur_adc_stream_tag; |
| 348 | unsigned int cur_adc_format; |
| 349 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 351 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | const struct hda_input_mux *input_mux; |
| 353 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 354 | struct alc_mic_route ext_mic; |
| 355 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | |
| 357 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 358 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 360 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 361 | int const_channel_count; |
| 362 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | |
| 364 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 365 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 366 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 367 | /* jack detection */ |
| 368 | struct snd_array jacks; |
| 369 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 370 | /* dynamic controls, init_verbs and input_mux */ |
| 371 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 372 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 373 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 374 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 375 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 376 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 377 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 378 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 379 | /* hooks */ |
| 380 | void (*init_hook)(struct hda_codec *codec); |
| 381 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 382 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 383 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 384 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 385 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 386 | /* for pin sensing */ |
| 387 | unsigned int sense_updated: 1; |
| 388 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 389 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 390 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 391 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 392 | /* other flags */ |
| 393 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 394 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 395 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 396 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 397 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 398 | /* for virtual master */ |
| 399 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 400 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 401 | struct hda_loopback_check loopback; |
| 402 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 403 | |
| 404 | /* for PLL fix */ |
| 405 | hda_nid_t pll_nid; |
| 406 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 407 | }; |
| 408 | |
| 409 | /* |
| 410 | * configuration template - to be copied to the spec instance |
| 411 | */ |
| 412 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 413 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 414 | * with spec |
| 415 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 416 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 417 | const struct hda_verb *init_verbs[5]; |
| 418 | unsigned int num_dacs; |
| 419 | hda_nid_t *dac_nids; |
| 420 | hda_nid_t dig_out_nid; /* optional */ |
| 421 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 422 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 423 | unsigned int num_adc_nids; |
| 424 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 425 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 426 | hda_nid_t dig_in_nid; |
| 427 | unsigned int num_channel_mode; |
| 428 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 429 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 430 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 431 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 432 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 433 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 434 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 435 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 436 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 437 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 438 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 439 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | }; |
| 441 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | |
| 443 | /* |
| 444 | * input MUX handling |
| 445 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 446 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 447 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | { |
| 449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 450 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 451 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 452 | if (mux_idx >= spec->num_mux_defs) |
| 453 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 454 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 455 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 456 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | } |
| 458 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 459 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 460 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | { |
| 462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 463 | struct alc_spec *spec = codec->spec; |
| 464 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 465 | |
| 466 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 467 | return 0; |
| 468 | } |
| 469 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 470 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 471 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | { |
| 473 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 474 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 475 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 476 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 477 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 478 | hda_nid_t nid = spec->capsrc_nids ? |
| 479 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 480 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 482 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 483 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 484 | if (!imux->num_items && mux_idx > 0) |
| 485 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 486 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 487 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 488 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 489 | /* Matrix-mixer style (e.g. ALC882) */ |
| 490 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 491 | unsigned int i, idx; |
| 492 | |
| 493 | idx = ucontrol->value.enumerated.item[0]; |
| 494 | if (idx >= imux->num_items) |
| 495 | idx = imux->num_items - 1; |
| 496 | if (*cur_val == idx) |
| 497 | return 0; |
| 498 | for (i = 0; i < imux->num_items; i++) { |
| 499 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 500 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 501 | imux->items[i].index, |
| 502 | HDA_AMP_MUTE, v); |
| 503 | } |
| 504 | *cur_val = idx; |
| 505 | return 1; |
| 506 | } else { |
| 507 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 508 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 509 | &spec->cur_mux[adc_idx]); |
| 510 | } |
| 511 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 512 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 513 | /* |
| 514 | * channel mode setting |
| 515 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 516 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 517 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | { |
| 519 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 520 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 521 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 522 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | } |
| 524 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 525 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 526 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | { |
| 528 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 529 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 530 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 531 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 532 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | } |
| 534 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 535 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 536 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | { |
| 538 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 539 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 540 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 541 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 542 | &spec->ext_channel_count); |
| 543 | if (err >= 0 && !spec->const_channel_count) { |
| 544 | spec->multiout.max_channels = spec->ext_channel_count; |
| 545 | if (spec->need_dac_fix) |
| 546 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 547 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 548 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | } |
| 550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 553 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 554 | * being part of a format specifier. Maximum allowed length of a value is |
| 555 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 556 | * |
| 557 | * Note: some retasking pin complexes seem to ignore requests for input |
| 558 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 559 | * are requested. Therefore order this list so that this behaviour will not |
| 560 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 561 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 562 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 563 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 564 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 565 | "Mic 50pc bias", "Mic 80pc bias", |
| 566 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 567 | }; |
| 568 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 569 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 570 | }; |
| 571 | /* 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] | 572 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 573 | * addition, "input" pins may or may not process the mic bias option |
| 574 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 575 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 576 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 578 | #define ALC_PIN_DIR_IN 0x00 |
| 579 | #define ALC_PIN_DIR_OUT 0x01 |
| 580 | #define ALC_PIN_DIR_INOUT 0x02 |
| 581 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 582 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 583 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 584 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 585 | * For each direction the minimum and maximum values are given. |
| 586 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 587 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 588 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 589 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 590 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 591 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 592 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 593 | }; |
| 594 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 595 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 596 | #define alc_pin_mode_n_items(_dir) \ |
| 597 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 598 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 599 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 600 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 601 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 602 | unsigned int item_num = uinfo->value.enumerated.item; |
| 603 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 604 | |
| 605 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 606 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 607 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 608 | |
| 609 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 610 | item_num = alc_pin_mode_min(dir); |
| 611 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 612 | return 0; |
| 613 | } |
| 614 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 615 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 616 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 617 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 618 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 619 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 620 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 621 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 622 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 623 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 624 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 625 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 626 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 627 | /* Find enumerated value for current pinctl setting */ |
| 628 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 629 | 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] | 630 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 631 | *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] | 632 | return 0; |
| 633 | } |
| 634 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 635 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 636 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 637 | { |
| 638 | signed int change; |
| 639 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 640 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 641 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 642 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 643 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 644 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 645 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 646 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 647 | 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] | 648 | val = alc_pin_mode_min(dir); |
| 649 | |
| 650 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 651 | if (change) { |
| 652 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 653 | snd_hda_codec_write_cache(codec, nid, 0, |
| 654 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 655 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 656 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 657 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 658 | * for the requested pin mode. Enum values of 2 or less are |
| 659 | * input modes. |
| 660 | * |
| 661 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 662 | * reduces noise slightly (particularly on input) so we'll |
| 663 | * do it. However, having both input and output buffers |
| 664 | * enabled simultaneously doesn't seem to be problematic if |
| 665 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 666 | */ |
| 667 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 668 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 669 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 670 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 671 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 672 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 673 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 674 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 675 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 676 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 677 | } |
| 678 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 679 | return change; |
| 680 | } |
| 681 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 682 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 683 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 684 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 685 | .info = alc_pin_mode_info, \ |
| 686 | .get = alc_pin_mode_get, \ |
| 687 | .put = alc_pin_mode_put, \ |
| 688 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 689 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 690 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 691 | * together using a mask with more than one bit set. This control is |
| 692 | * currently used only by the ALC260 test model. At this stage they are not |
| 693 | * needed for any "production" models. |
| 694 | */ |
| 695 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 696 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 697 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 698 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 699 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 700 | { |
| 701 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 702 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 703 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 704 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 705 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 706 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 707 | |
| 708 | *valp = (val & mask) != 0; |
| 709 | return 0; |
| 710 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 711 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 712 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 713 | { |
| 714 | signed int change; |
| 715 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 716 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 717 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 718 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 719 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 720 | AC_VERB_GET_GPIO_DATA, |
| 721 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 722 | |
| 723 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 724 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 725 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 726 | gpio_data &= ~mask; |
| 727 | else |
| 728 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 729 | snd_hda_codec_write_cache(codec, nid, 0, |
| 730 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 731 | |
| 732 | return change; |
| 733 | } |
| 734 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 735 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 736 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 737 | .info = alc_gpio_data_info, \ |
| 738 | .get = alc_gpio_data_get, \ |
| 739 | .put = alc_gpio_data_put, \ |
| 740 | .private_value = nid | (mask<<16) } |
| 741 | #endif /* CONFIG_SND_DEBUG */ |
| 742 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 743 | /* A switch control to allow the enabling of the digital IO pins on the |
| 744 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 745 | * to provide something in the test model allowing digital outputs to be |
| 746 | * identified if present. If models are found which can utilise these |
| 747 | * outputs a more complete mixer control can be devised for those models if |
| 748 | * necessary. |
| 749 | */ |
| 750 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 751 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 752 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 753 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 754 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 755 | { |
| 756 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 757 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 758 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 759 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 760 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 761 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 762 | |
| 763 | *valp = (val & mask) != 0; |
| 764 | return 0; |
| 765 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 766 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 767 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 768 | { |
| 769 | signed int change; |
| 770 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 771 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 772 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 773 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 774 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 775 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 776 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 777 | |
| 778 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 779 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 780 | if (val==0) |
| 781 | ctrl_data &= ~mask; |
| 782 | else |
| 783 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 784 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 785 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 786 | |
| 787 | return change; |
| 788 | } |
| 789 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 790 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 791 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 792 | .info = alc_spdif_ctrl_info, \ |
| 793 | .get = alc_spdif_ctrl_get, \ |
| 794 | .put = alc_spdif_ctrl_put, \ |
| 795 | .private_value = nid | (mask<<16) } |
| 796 | #endif /* CONFIG_SND_DEBUG */ |
| 797 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 798 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 799 | * Again, this is only used in the ALC26x test models to help identify when |
| 800 | * the EAPD line must be asserted for features to work. |
| 801 | */ |
| 802 | #ifdef CONFIG_SND_DEBUG |
| 803 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 804 | |
| 805 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 806 | struct snd_ctl_elem_value *ucontrol) |
| 807 | { |
| 808 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 809 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 810 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 811 | long *valp = ucontrol->value.integer.value; |
| 812 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 813 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 814 | |
| 815 | *valp = (val & mask) != 0; |
| 816 | return 0; |
| 817 | } |
| 818 | |
| 819 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 820 | struct snd_ctl_elem_value *ucontrol) |
| 821 | { |
| 822 | int change; |
| 823 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 824 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 825 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 826 | long val = *ucontrol->value.integer.value; |
| 827 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 828 | AC_VERB_GET_EAPD_BTLENABLE, |
| 829 | 0x00); |
| 830 | |
| 831 | /* Set/unset the masked control bit(s) as needed */ |
| 832 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 833 | if (!val) |
| 834 | ctrl_data &= ~mask; |
| 835 | else |
| 836 | ctrl_data |= mask; |
| 837 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 838 | ctrl_data); |
| 839 | |
| 840 | return change; |
| 841 | } |
| 842 | |
| 843 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 844 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 845 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 846 | .info = alc_eapd_ctrl_info, \ |
| 847 | .get = alc_eapd_ctrl_get, \ |
| 848 | .put = alc_eapd_ctrl_put, \ |
| 849 | .private_value = nid | (mask<<16) } |
| 850 | #endif /* CONFIG_SND_DEBUG */ |
| 851 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 852 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 853 | * set up the input pin config (depending on the given auto-pin type) |
| 854 | */ |
| 855 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 856 | int auto_pin_type) |
| 857 | { |
| 858 | unsigned int val = PIN_IN; |
| 859 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 860 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 861 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 862 | unsigned int oldval; |
| 863 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 864 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 865 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 866 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 867 | /* if the default pin setup is vref50, we give it priority */ |
| 868 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 869 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 870 | else if (pincap & AC_PINCAP_VREF_50) |
| 871 | val = PIN_VREF50; |
| 872 | else if (pincap & AC_PINCAP_VREF_100) |
| 873 | val = PIN_VREF100; |
| 874 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 875 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 876 | } |
| 877 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 878 | } |
| 879 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 880 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 881 | { |
| 882 | struct alc_spec *spec = codec->spec; |
| 883 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 884 | |
| 885 | if (!cfg->line_outs) { |
| 886 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 887 | cfg->line_out_pins[cfg->line_outs]) |
| 888 | cfg->line_outs++; |
| 889 | } |
| 890 | if (!cfg->speaker_outs) { |
| 891 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 892 | cfg->speaker_pins[cfg->speaker_outs]) |
| 893 | cfg->speaker_outs++; |
| 894 | } |
| 895 | if (!cfg->hp_outs) { |
| 896 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 897 | cfg->hp_pins[cfg->hp_outs]) |
| 898 | cfg->hp_outs++; |
| 899 | } |
| 900 | } |
| 901 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 902 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 903 | */ |
| 904 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 905 | { |
| 906 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 907 | return; |
| 908 | spec->mixers[spec->num_mixers++] = mix; |
| 909 | } |
| 910 | |
| 911 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 912 | { |
| 913 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 914 | return; |
| 915 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 916 | } |
| 917 | |
| 918 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 919 | * set up from the preset table |
| 920 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 921 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 922 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 923 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 924 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 925 | int i; |
| 926 | |
| 927 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 928 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 929 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 930 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 931 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 932 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 933 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 934 | spec->channel_mode = preset->channel_mode; |
| 935 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 936 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 937 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 938 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 939 | if (preset->const_channel_count) |
| 940 | spec->multiout.max_channels = preset->const_channel_count; |
| 941 | else |
| 942 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 943 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 944 | |
| 945 | spec->multiout.num_dacs = preset->num_dacs; |
| 946 | spec->multiout.dac_nids = preset->dac_nids; |
| 947 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 948 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 949 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 950 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 951 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 952 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 953 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 954 | spec->input_mux = preset->input_mux; |
| 955 | |
| 956 | spec->num_adc_nids = preset->num_adc_nids; |
| 957 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 958 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 959 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 960 | |
| 961 | spec->unsol_event = preset->unsol_event; |
| 962 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 963 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 964 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 965 | spec->loopback.amplist = preset->loopbacks; |
| 966 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 967 | |
| 968 | if (preset->setup) |
| 969 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 970 | |
| 971 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 972 | } |
| 973 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 974 | /* Enable GPIO mask and set output */ |
| 975 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 976 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 977 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 978 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 979 | { } |
| 980 | }; |
| 981 | |
| 982 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 983 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 984 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 985 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 986 | { } |
| 987 | }; |
| 988 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 989 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 990 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 991 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 992 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 993 | { } |
| 994 | }; |
| 995 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 996 | /* |
| 997 | * Fix hardware PLL issue |
| 998 | * On some codecs, the analog PLL gating control must be off while |
| 999 | * the default value is 1. |
| 1000 | */ |
| 1001 | static void alc_fix_pll(struct hda_codec *codec) |
| 1002 | { |
| 1003 | struct alc_spec *spec = codec->spec; |
| 1004 | unsigned int val; |
| 1005 | |
| 1006 | if (!spec->pll_nid) |
| 1007 | return; |
| 1008 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1009 | spec->pll_coef_idx); |
| 1010 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1011 | AC_VERB_GET_PROC_COEF, 0); |
| 1012 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1013 | spec->pll_coef_idx); |
| 1014 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1015 | val & ~(1 << spec->pll_coef_bit)); |
| 1016 | } |
| 1017 | |
| 1018 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1019 | unsigned int coef_idx, unsigned int coef_bit) |
| 1020 | { |
| 1021 | struct alc_spec *spec = codec->spec; |
| 1022 | spec->pll_nid = nid; |
| 1023 | spec->pll_coef_idx = coef_idx; |
| 1024 | spec->pll_coef_bit = coef_bit; |
| 1025 | alc_fix_pll(codec); |
| 1026 | } |
| 1027 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1028 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
| 1029 | static void alc_free_jack_priv(struct snd_jack *jack) |
| 1030 | { |
| 1031 | struct alc_jack *jacks = jack->private_data; |
| 1032 | jacks->nid = 0; |
| 1033 | jacks->jack = NULL; |
| 1034 | } |
| 1035 | |
| 1036 | static int alc_add_jack(struct hda_codec *codec, |
| 1037 | hda_nid_t nid, int type) |
| 1038 | { |
| 1039 | struct alc_spec *spec; |
| 1040 | struct alc_jack *jack; |
| 1041 | const char *name; |
| 1042 | int err; |
| 1043 | |
| 1044 | spec = codec->spec; |
| 1045 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
| 1046 | jack = snd_array_new(&spec->jacks); |
| 1047 | if (!jack) |
| 1048 | return -ENOMEM; |
| 1049 | |
| 1050 | jack->nid = nid; |
| 1051 | jack->type = type; |
| 1052 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; |
| 1053 | |
| 1054 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); |
| 1055 | if (err < 0) |
| 1056 | return err; |
| 1057 | jack->jack->private_data = jack; |
| 1058 | jack->jack->private_free = alc_free_jack_priv; |
| 1059 | return 0; |
| 1060 | } |
| 1061 | |
| 1062 | static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1063 | { |
| 1064 | struct alc_spec *spec = codec->spec; |
| 1065 | struct alc_jack *jacks = spec->jacks.list; |
| 1066 | |
| 1067 | if (jacks) { |
| 1068 | int i; |
| 1069 | for (i = 0; i < spec->jacks.used; i++) { |
| 1070 | if (jacks->nid == nid) { |
| 1071 | unsigned int present; |
| 1072 | present = snd_hda_jack_detect(codec, nid); |
| 1073 | |
| 1074 | present = (present) ? jacks->type : 0; |
| 1075 | |
| 1076 | snd_jack_report(jacks->jack, present); |
| 1077 | } |
| 1078 | jacks++; |
| 1079 | } |
| 1080 | } |
| 1081 | } |
| 1082 | |
| 1083 | static int alc_init_jacks(struct hda_codec *codec) |
| 1084 | { |
| 1085 | struct alc_spec *spec = codec->spec; |
| 1086 | int err; |
| 1087 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1088 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1089 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1090 | if (hp_nid) { |
| 1091 | err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE); |
| 1092 | if (err < 0) |
| 1093 | return err; |
| 1094 | alc_report_jack(codec, hp_nid); |
| 1095 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1096 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1097 | if (mic_nid) { |
| 1098 | err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE); |
| 1099 | if (err < 0) |
| 1100 | return err; |
| 1101 | alc_report_jack(codec, mic_nid); |
| 1102 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1103 | |
| 1104 | return 0; |
| 1105 | } |
| 1106 | #else |
| 1107 | static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1108 | { |
| 1109 | } |
| 1110 | |
| 1111 | static inline int alc_init_jacks(struct hda_codec *codec) |
| 1112 | { |
| 1113 | return 0; |
| 1114 | } |
| 1115 | #endif |
| 1116 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1117 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1118 | { |
| 1119 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1120 | unsigned int mute; |
| 1121 | hda_nid_t nid; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1122 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1123 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1124 | spec->jack_present = 0; |
| 1125 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1126 | nid = spec->autocfg.hp_pins[i]; |
| 1127 | if (!nid) |
| 1128 | break; |
| 1129 | if (snd_hda_jack_detect(codec, nid)) { |
| 1130 | spec->jack_present = 1; |
| 1131 | break; |
| 1132 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1133 | alc_report_jack(codec, spec->autocfg.hp_pins[i]); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1134 | } |
| 1135 | |
| 1136 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
| 1137 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1138 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1139 | nid = spec->autocfg.speaker_pins[i]; |
| 1140 | if (!nid) |
| 1141 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1142 | if (pinctl) { |
| 1143 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1144 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1145 | spec->jack_present ? 0 : PIN_OUT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1146 | } else { |
| 1147 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1148 | HDA_AMP_MUTE, mute); |
| 1149 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1150 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1151 | } |
| 1152 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1153 | static void alc_automute_pin(struct hda_codec *codec) |
| 1154 | { |
| 1155 | alc_automute_speaker(codec, 1); |
| 1156 | } |
| 1157 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1158 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1159 | hda_nid_t nid) |
| 1160 | { |
| 1161 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1162 | int i, nums; |
| 1163 | |
| 1164 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1165 | for (i = 0; i < nums; i++) |
| 1166 | if (conn[i] == nid) |
| 1167 | return i; |
| 1168 | return -1; |
| 1169 | } |
| 1170 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1171 | /* switch the current ADC according to the jack state */ |
| 1172 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1173 | { |
| 1174 | struct alc_spec *spec = codec->spec; |
| 1175 | unsigned int present; |
| 1176 | hda_nid_t new_adc; |
| 1177 | |
| 1178 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1179 | if (present) |
| 1180 | spec->cur_adc_idx = 1; |
| 1181 | else |
| 1182 | spec->cur_adc_idx = 0; |
| 1183 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1184 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1185 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1186 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1187 | spec->cur_adc = new_adc; |
| 1188 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1189 | spec->cur_adc_stream_tag, 0, |
| 1190 | spec->cur_adc_format); |
| 1191 | } |
| 1192 | } |
| 1193 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1194 | static void alc_mic_automute(struct hda_codec *codec) |
| 1195 | { |
| 1196 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1197 | struct alc_mic_route *dead, *alive; |
| 1198 | unsigned int present, type; |
| 1199 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1200 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1201 | if (!spec->auto_mic) |
| 1202 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1203 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1204 | return; |
| 1205 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1206 | return; |
| 1207 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1208 | if (spec->dual_adc_switch) { |
| 1209 | alc_dual_mic_adc_auto_switch(codec); |
| 1210 | return; |
| 1211 | } |
| 1212 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1213 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1214 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1215 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1216 | if (present) { |
| 1217 | alive = &spec->ext_mic; |
| 1218 | dead = &spec->int_mic; |
| 1219 | } else { |
| 1220 | alive = &spec->int_mic; |
| 1221 | dead = &spec->ext_mic; |
| 1222 | } |
| 1223 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1224 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1225 | if (type == AC_WID_AUD_MIX) { |
| 1226 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1227 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1228 | alive->mux_idx, |
| 1229 | HDA_AMP_MUTE, 0); |
| 1230 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1231 | dead->mux_idx, |
| 1232 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1233 | } else { |
| 1234 | /* MUX style (e.g. ALC880) */ |
| 1235 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1236 | AC_VERB_SET_CONNECT_SEL, |
| 1237 | alive->mux_idx); |
| 1238 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1239 | alc_report_jack(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1240 | |
| 1241 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1242 | } |
| 1243 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1244 | /* unsolicited event for HP jack sensing */ |
| 1245 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1246 | { |
| 1247 | if (codec->vendor_id == 0x10ec0880) |
| 1248 | res >>= 28; |
| 1249 | else |
| 1250 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1251 | switch (res) { |
| 1252 | case ALC880_HP_EVENT: |
| 1253 | alc_automute_pin(codec); |
| 1254 | break; |
| 1255 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1256 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1257 | break; |
| 1258 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1259 | } |
| 1260 | |
| 1261 | static void alc_inithook(struct hda_codec *codec) |
| 1262 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1263 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1264 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1265 | } |
| 1266 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1267 | /* additional initialization for ALC888 variants */ |
| 1268 | static void alc888_coef_init(struct hda_codec *codec) |
| 1269 | { |
| 1270 | unsigned int tmp; |
| 1271 | |
| 1272 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1273 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1274 | 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] | 1275 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1276 | /* alc888S-VC */ |
| 1277 | snd_hda_codec_read(codec, 0x20, 0, |
| 1278 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1279 | else |
| 1280 | /* alc888-VB */ |
| 1281 | snd_hda_codec_read(codec, 0x20, 0, |
| 1282 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1283 | } |
| 1284 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1285 | static void alc889_coef_init(struct hda_codec *codec) |
| 1286 | { |
| 1287 | unsigned int tmp; |
| 1288 | |
| 1289 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1290 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1291 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1292 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1293 | } |
| 1294 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1295 | /* turn on/off EAPD control (only if available) */ |
| 1296 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1297 | { |
| 1298 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1299 | return; |
| 1300 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1301 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1302 | on ? 2 : 0); |
| 1303 | } |
| 1304 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1305 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1306 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1307 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1308 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1309 | switch (type) { |
| 1310 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1311 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1312 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1313 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1314 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1315 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1316 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1317 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1318 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1319 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1320 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1321 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1322 | set_eapd(codec, 0x0f, 1); |
| 1323 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1324 | break; |
| 1325 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1326 | case 0x10ec0267: |
| 1327 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1328 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1329 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1330 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1331 | case 0x10ec0660: |
| 1332 | case 0x10ec0662: |
| 1333 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1334 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1335 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1336 | set_eapd(codec, 0x14, 1); |
| 1337 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1338 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1339 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1340 | switch (codec->vendor_id) { |
| 1341 | case 0x10ec0260: |
| 1342 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1343 | AC_VERB_SET_COEF_INDEX, 7); |
| 1344 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1345 | AC_VERB_GET_PROC_COEF, 0); |
| 1346 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1347 | AC_VERB_SET_COEF_INDEX, 7); |
| 1348 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1349 | AC_VERB_SET_PROC_COEF, |
| 1350 | tmp | 0x2010); |
| 1351 | break; |
| 1352 | case 0x10ec0262: |
| 1353 | case 0x10ec0880: |
| 1354 | case 0x10ec0882: |
| 1355 | case 0x10ec0883: |
| 1356 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1357 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1358 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1359 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1360 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1361 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1362 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1363 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1364 | #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] | 1365 | case 0x10ec0267: |
| 1366 | case 0x10ec0268: |
| 1367 | snd_hda_codec_write(codec, 0x20, 0, |
| 1368 | AC_VERB_SET_COEF_INDEX, 7); |
| 1369 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1370 | AC_VERB_GET_PROC_COEF, 0); |
| 1371 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1372 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1373 | snd_hda_codec_write(codec, 0x20, 0, |
| 1374 | AC_VERB_SET_PROC_COEF, |
| 1375 | tmp | 0x3000); |
| 1376 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1377 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1378 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1379 | break; |
| 1380 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1381 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1382 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1383 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1384 | { |
| 1385 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1386 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1387 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1388 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1389 | if (!cfg->hp_pins[0]) { |
| 1390 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1391 | return; |
| 1392 | } |
| 1393 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1394 | if (!cfg->speaker_pins[0]) { |
| 1395 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1396 | return; |
| 1397 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1398 | sizeof(cfg->speaker_pins)); |
| 1399 | cfg->speaker_outs = cfg->line_outs; |
| 1400 | } |
| 1401 | |
| 1402 | if (!cfg->hp_pins[0]) { |
| 1403 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1404 | sizeof(cfg->hp_pins)); |
| 1405 | cfg->hp_outs = cfg->line_outs; |
| 1406 | } |
| 1407 | |
| 1408 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1409 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1410 | cfg->hp_pins[i]); |
| 1411 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1412 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1413 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1414 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1415 | spec->unsol_event = alc_sku_unsol_event; |
| 1416 | } |
| 1417 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1418 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1419 | { |
| 1420 | struct alc_spec *spec = codec->spec; |
| 1421 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1422 | hda_nid_t fixed, ext; |
| 1423 | int i; |
| 1424 | |
| 1425 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1426 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1427 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1428 | return; |
| 1429 | |
| 1430 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1431 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1432 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1433 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1434 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1435 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1436 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1437 | if (fixed) |
| 1438 | return; /* already occupied */ |
| 1439 | fixed = nid; |
| 1440 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1441 | case INPUT_PIN_ATTR_UNUSED: |
| 1442 | return; /* invalid entry */ |
| 1443 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1444 | if (ext) |
| 1445 | return; /* already occupied */ |
| 1446 | ext = nid; |
| 1447 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1448 | } |
| 1449 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1450 | if (!ext || !fixed) |
| 1451 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1452 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1453 | return; /* no unsol support */ |
| 1454 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1455 | ext, fixed); |
| 1456 | spec->ext_mic.pin = ext; |
| 1457 | spec->int_mic.pin = fixed; |
| 1458 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1459 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1460 | spec->auto_mic = 1; |
| 1461 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1462 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1463 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1464 | spec->unsol_event = alc_sku_unsol_event; |
| 1465 | } |
| 1466 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1467 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1468 | * the driver to ignore any present sku defines. |
| 1469 | */ |
| 1470 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1471 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1472 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1473 | { |
| 1474 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1475 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1476 | struct alc_spec *spec = codec->spec; |
| 1477 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1478 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1479 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1480 | if (spec->cdefine.fixup) { |
| 1481 | ass = spec->cdefine.sku_cfg; |
| 1482 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1483 | return -1; |
| 1484 | goto do_sku; |
| 1485 | } |
| 1486 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1487 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1488 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1489 | goto do_sku; |
| 1490 | |
| 1491 | nid = 0x1d; |
| 1492 | if (codec->vendor_id == 0x10ec0260) |
| 1493 | nid = 0x17; |
| 1494 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1495 | |
| 1496 | if (!(ass & 1)) { |
| 1497 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1498 | codec->chip_name, ass); |
| 1499 | return -1; |
| 1500 | } |
| 1501 | |
| 1502 | /* check sum */ |
| 1503 | tmp = 0; |
| 1504 | for (i = 1; i < 16; i++) { |
| 1505 | if ((ass >> i) & 1) |
| 1506 | tmp++; |
| 1507 | } |
| 1508 | if (((ass >> 16) & 0xf) != tmp) |
| 1509 | return -1; |
| 1510 | |
| 1511 | spec->cdefine.port_connectivity = ass >> 30; |
| 1512 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1513 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1514 | spec->cdefine.customization = ass >> 8; |
| 1515 | do_sku: |
| 1516 | spec->cdefine.sku_cfg = ass; |
| 1517 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1518 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1519 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1520 | spec->cdefine.override = ass & 0x1; |
| 1521 | |
| 1522 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1523 | nid, spec->cdefine.sku_cfg); |
| 1524 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1525 | spec->cdefine.port_connectivity); |
| 1526 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1527 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1528 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1529 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1530 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1531 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1532 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1533 | |
| 1534 | return 0; |
| 1535 | } |
| 1536 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1537 | /* check subsystem ID and set up device-specific initialization; |
| 1538 | * return 1 if initialized, 0 if invalid SSID |
| 1539 | */ |
| 1540 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1541 | * 31 ~ 16 : Manufacture ID |
| 1542 | * 15 ~ 8 : SKU ID |
| 1543 | * 7 ~ 0 : Assembly ID |
| 1544 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1545 | */ |
| 1546 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1547 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1548 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1549 | { |
| 1550 | unsigned int ass, tmp, i; |
| 1551 | unsigned nid; |
| 1552 | struct alc_spec *spec = codec->spec; |
| 1553 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1554 | if (spec->cdefine.fixup) { |
| 1555 | ass = spec->cdefine.sku_cfg; |
| 1556 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1557 | return 0; |
| 1558 | goto do_sku; |
| 1559 | } |
| 1560 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1561 | ass = codec->subsystem_id & 0xffff; |
| 1562 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1563 | goto do_sku; |
| 1564 | |
| 1565 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1566 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1567 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1568 | * 29~21 : reserve |
| 1569 | * 20 : PCBEEP input |
| 1570 | * 19~16 : Check sum (15:1) |
| 1571 | * 15~1 : Custom |
| 1572 | * 0 : override |
| 1573 | */ |
| 1574 | nid = 0x1d; |
| 1575 | if (codec->vendor_id == 0x10ec0260) |
| 1576 | nid = 0x17; |
| 1577 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1578 | snd_printd("realtek: No valid SSID, " |
| 1579 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1580 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1581 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1582 | return 0; |
| 1583 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1584 | return 0; |
| 1585 | |
| 1586 | /* check sum */ |
| 1587 | tmp = 0; |
| 1588 | for (i = 1; i < 16; i++) { |
| 1589 | if ((ass >> i) & 1) |
| 1590 | tmp++; |
| 1591 | } |
| 1592 | if (((ass >> 16) & 0xf) != tmp) |
| 1593 | return 0; |
| 1594 | do_sku: |
| 1595 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1596 | ass & 0xffff, codec->vendor_id); |
| 1597 | /* |
| 1598 | * 0 : override |
| 1599 | * 1 : Swap Jack |
| 1600 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1601 | * 3~5 : External Amplifier control |
| 1602 | * 7~6 : Reserved |
| 1603 | */ |
| 1604 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1605 | switch (tmp) { |
| 1606 | case 1: |
| 1607 | spec->init_amp = ALC_INIT_GPIO1; |
| 1608 | break; |
| 1609 | case 3: |
| 1610 | spec->init_amp = ALC_INIT_GPIO2; |
| 1611 | break; |
| 1612 | case 7: |
| 1613 | spec->init_amp = ALC_INIT_GPIO3; |
| 1614 | break; |
| 1615 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1616 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1617 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1618 | break; |
| 1619 | } |
| 1620 | |
| 1621 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1622 | * when the external headphone out jack is plugged" |
| 1623 | */ |
| 1624 | if (!(ass & 0x8000)) |
| 1625 | return 1; |
| 1626 | /* |
| 1627 | * 10~8 : Jack location |
| 1628 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1629 | * 14~13: Resvered |
| 1630 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1631 | * when the external headphone out jack is plugged" |
| 1632 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1633 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1634 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1635 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1636 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1637 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1638 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1639 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1640 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1641 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1642 | else if (tmp == 3) |
| 1643 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1644 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1645 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1646 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1647 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1648 | return 1; |
| 1649 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1650 | } |
| 1651 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1652 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1653 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1654 | return 1; |
| 1655 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1656 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1657 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1658 | hda_nid_t porta, hda_nid_t porte, |
| 1659 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1660 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1661 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1662 | struct alc_spec *spec = codec->spec; |
| 1663 | snd_printd("realtek: " |
| 1664 | "Enable default setup for auto mode as fallback\n"); |
| 1665 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1666 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1667 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1668 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1669 | } |
| 1670 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1671 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1672 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1673 | */ |
| 1674 | |
| 1675 | struct alc_pincfg { |
| 1676 | hda_nid_t nid; |
| 1677 | u32 val; |
| 1678 | }; |
| 1679 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1680 | struct alc_model_fixup { |
| 1681 | const int id; |
| 1682 | const char *name; |
| 1683 | }; |
| 1684 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1685 | struct alc_fixup { |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1686 | unsigned int sku; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1687 | const struct alc_pincfg *pins; |
| 1688 | const struct hda_verb *verbs; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1689 | void (*func)(struct hda_codec *codec, const struct alc_fixup *fix, |
| 1690 | int pre_init); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1691 | }; |
| 1692 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1693 | static void __alc_pick_fixup(struct hda_codec *codec, |
| 1694 | const struct alc_fixup *fix, |
| 1695 | const char *modelname, |
| 1696 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1697 | { |
| 1698 | const struct alc_pincfg *cfg; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1699 | struct alc_spec *spec; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1700 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1701 | cfg = fix->pins; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1702 | if (pre_init && fix->sku) { |
| 1703 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1704 | snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n", |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1705 | codec->chip_name, modelname); |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1706 | #endif |
| 1707 | spec = codec->spec; |
| 1708 | spec->cdefine.sku_cfg = fix->sku; |
| 1709 | spec->cdefine.fixup = 1; |
| 1710 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1711 | if (pre_init && cfg) { |
| 1712 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1713 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1714 | codec->chip_name, modelname); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1715 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1716 | for (; cfg->nid; cfg++) |
| 1717 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1718 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1719 | if (!pre_init && fix->verbs) { |
| 1720 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1721 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1722 | codec->chip_name, modelname); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1723 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1724 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1725 | } |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1726 | if (fix->func) { |
| 1727 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1728 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n", |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1729 | codec->chip_name, modelname); |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1730 | #endif |
| 1731 | fix->func(codec, fix, pre_init); |
| 1732 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1733 | } |
| 1734 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1735 | static void alc_pick_fixup(struct hda_codec *codec, |
| 1736 | const struct snd_pci_quirk *quirk, |
| 1737 | const struct alc_fixup *fix, |
| 1738 | int pre_init) |
| 1739 | { |
| 1740 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1741 | if (quirk) { |
| 1742 | fix += quirk->value; |
| 1743 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1744 | __alc_pick_fixup(codec, fix, quirk->name, pre_init); |
| 1745 | #else |
| 1746 | __alc_pick_fixup(codec, fix, NULL, pre_init); |
| 1747 | #endif |
| 1748 | } |
| 1749 | } |
| 1750 | |
| 1751 | static void alc_pick_fixup_model(struct hda_codec *codec, |
| 1752 | const struct alc_model_fixup *models, |
| 1753 | const struct snd_pci_quirk *quirk, |
| 1754 | const struct alc_fixup *fix, |
| 1755 | int pre_init) |
| 1756 | { |
| 1757 | if (codec->modelname && models) { |
| 1758 | while (models->name) { |
| 1759 | if (!strcmp(codec->modelname, models->name)) { |
| 1760 | fix += models->id; |
| 1761 | break; |
| 1762 | } |
| 1763 | models++; |
| 1764 | } |
| 1765 | __alc_pick_fixup(codec, fix, codec->modelname, pre_init); |
| 1766 | } else { |
| 1767 | alc_pick_fixup(codec, quirk, fix, pre_init); |
| 1768 | } |
| 1769 | } |
| 1770 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1771 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1772 | unsigned int coef_idx) |
| 1773 | { |
| 1774 | unsigned int val; |
| 1775 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1776 | coef_idx); |
| 1777 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1778 | AC_VERB_GET_PROC_COEF, 0); |
| 1779 | return val; |
| 1780 | } |
| 1781 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1782 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1783 | unsigned int coef_val) |
| 1784 | { |
| 1785 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1786 | coef_idx); |
| 1787 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1788 | coef_val); |
| 1789 | } |
| 1790 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1791 | /* set right pin controls for digital I/O */ |
| 1792 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1793 | { |
| 1794 | struct alc_spec *spec = codec->spec; |
| 1795 | int i; |
| 1796 | hda_nid_t pin; |
| 1797 | |
| 1798 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1799 | pin = spec->autocfg.dig_out_pins[i]; |
| 1800 | if (pin) { |
| 1801 | snd_hda_codec_write(codec, pin, 0, |
| 1802 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1803 | PIN_OUT); |
| 1804 | } |
| 1805 | } |
| 1806 | pin = spec->autocfg.dig_in_pin; |
| 1807 | if (pin) |
| 1808 | snd_hda_codec_write(codec, pin, 0, |
| 1809 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1810 | PIN_IN); |
| 1811 | } |
| 1812 | |
| 1813 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1814 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1815 | { |
| 1816 | struct alc_spec *spec = codec->spec; |
| 1817 | int i, err; |
| 1818 | hda_nid_t dig_nid; |
| 1819 | |
| 1820 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1821 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1822 | err = snd_hda_get_connections(codec, |
| 1823 | spec->autocfg.dig_out_pins[i], |
| 1824 | &dig_nid, 1); |
| 1825 | if (err < 0) |
| 1826 | continue; |
| 1827 | if (!i) { |
| 1828 | spec->multiout.dig_out_nid = dig_nid; |
| 1829 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1830 | } else { |
| 1831 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1832 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1833 | break; |
| 1834 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1835 | } |
| 1836 | } |
| 1837 | |
| 1838 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1839 | dig_nid = codec->start_nid; |
| 1840 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1841 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1842 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1843 | continue; |
| 1844 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1845 | continue; |
| 1846 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1847 | continue; |
| 1848 | err = get_connection_index(codec, dig_nid, |
| 1849 | spec->autocfg.dig_in_pin); |
| 1850 | if (err >= 0) { |
| 1851 | spec->dig_in_nid = dig_nid; |
| 1852 | break; |
| 1853 | } |
| 1854 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1855 | } |
| 1856 | } |
| 1857 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1858 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1859 | * ALC888 |
| 1860 | */ |
| 1861 | |
| 1862 | /* |
| 1863 | * 2ch mode |
| 1864 | */ |
| 1865 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1866 | /* Mic-in jack as mic in */ |
| 1867 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1868 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1869 | /* Line-in jack as Line in */ |
| 1870 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1871 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1872 | /* Line-Out as Front */ |
| 1873 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1874 | { } /* end */ |
| 1875 | }; |
| 1876 | |
| 1877 | /* |
| 1878 | * 4ch mode |
| 1879 | */ |
| 1880 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1881 | /* Mic-in jack as mic in */ |
| 1882 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1883 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1884 | /* Line-in jack as Surround */ |
| 1885 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1886 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1887 | /* Line-Out as Front */ |
| 1888 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1889 | { } /* end */ |
| 1890 | }; |
| 1891 | |
| 1892 | /* |
| 1893 | * 6ch mode |
| 1894 | */ |
| 1895 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1896 | /* Mic-in jack as CLFE */ |
| 1897 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1898 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1899 | /* Line-in jack as Surround */ |
| 1900 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1901 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1902 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1903 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1904 | { } /* end */ |
| 1905 | }; |
| 1906 | |
| 1907 | /* |
| 1908 | * 8ch mode |
| 1909 | */ |
| 1910 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1911 | /* Mic-in jack as CLFE */ |
| 1912 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1913 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1914 | /* Line-in jack as Surround */ |
| 1915 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1916 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1917 | /* Line-Out as Side */ |
| 1918 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1919 | { } /* end */ |
| 1920 | }; |
| 1921 | |
| 1922 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1923 | { 2, alc888_4ST_ch2_intel_init }, |
| 1924 | { 4, alc888_4ST_ch4_intel_init }, |
| 1925 | { 6, alc888_4ST_ch6_intel_init }, |
| 1926 | { 8, alc888_4ST_ch8_intel_init }, |
| 1927 | }; |
| 1928 | |
| 1929 | /* |
| 1930 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1931 | */ |
| 1932 | |
| 1933 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1934 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1935 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1936 | /* Connect Internal HP to Front */ |
| 1937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1938 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1939 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1940 | /* Connect Bass HP to Front */ |
| 1941 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1942 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1943 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1944 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1945 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1946 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1947 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1948 | /* Connect Mic jack to CLFE */ |
| 1949 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1950 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1951 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1952 | /* Connect Line-in jack to Surround */ |
| 1953 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1954 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1955 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1956 | /* Connect HP out jack to Front */ |
| 1957 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1958 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1959 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1960 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1961 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1962 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1963 | {} |
| 1964 | }; |
| 1965 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1966 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1967 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1968 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1969 | } |
| 1970 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1971 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1972 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1973 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1974 | if (codec->vendor_id == 0x10ec0880) |
| 1975 | res >>= 28; |
| 1976 | else |
| 1977 | res >>= 26; |
| 1978 | if (res == ALC880_HP_EVENT) |
| 1979 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1980 | } |
| 1981 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1982 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1983 | { |
| 1984 | struct alc_spec *spec = codec->spec; |
| 1985 | |
| 1986 | spec->autocfg.hp_pins[0] = 0x15; |
| 1987 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1988 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1989 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1990 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1991 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1992 | } |
| 1993 | |
| 1994 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1995 | { |
| 1996 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1997 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1998 | } |
| 1999 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2000 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2001 | { |
| 2002 | struct alc_spec *spec = codec->spec; |
| 2003 | |
| 2004 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 2005 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 2006 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 2007 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2008 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2009 | |
| 2010 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2011 | * ALC888 Acer Aspire 4930G model |
| 2012 | */ |
| 2013 | |
| 2014 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 2015 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2016 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2017 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2018 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2019 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2020 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2021 | /* Connect Internal HP to front */ |
| 2022 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2023 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2024 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2025 | /* Connect HP out to front */ |
| 2026 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2028 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2029 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2030 | { } |
| 2031 | }; |
| 2032 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2033 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2034 | * ALC888 Acer Aspire 6530G model |
| 2035 | */ |
| 2036 | |
| 2037 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2038 | /* Route to built-in subwoofer as well as speakers */ |
| 2039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2040 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2041 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2042 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2043 | /* Bias voltage on for external mic port */ |
| 2044 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2045 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2046 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2047 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2048 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2049 | /* Enable unsolicited event for HP jack */ |
| 2050 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2051 | /* Enable speaker output */ |
| 2052 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2053 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2054 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2055 | /* Enable headphone output */ |
| 2056 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2057 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2058 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2059 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2060 | { } |
| 2061 | }; |
| 2062 | |
| 2063 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2064 | *ALC888 Acer Aspire 7730G model |
| 2065 | */ |
| 2066 | |
| 2067 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2068 | /* Bias voltage on for external mic port */ |
| 2069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2070 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2071 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2072 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2073 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2074 | /* Enable unsolicited event for HP jack */ |
| 2075 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2076 | /* Enable speaker output */ |
| 2077 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2078 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2079 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2080 | /* Enable headphone output */ |
| 2081 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2082 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2083 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2084 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2085 | /*Enable internal subwoofer */ |
| 2086 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2087 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2088 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2089 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2090 | { } |
| 2091 | }; |
| 2092 | |
| 2093 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2094 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2095 | */ |
| 2096 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2097 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2098 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2099 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2100 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2101 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2102 | /* Enable unsolicited event for HP jack */ |
| 2103 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2104 | /* Connect Internal Front to Front */ |
| 2105 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2106 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2107 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2108 | /* Connect Internal Rear to Rear */ |
| 2109 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2110 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2111 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2112 | /* Connect Internal CLFE to CLFE */ |
| 2113 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2114 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2115 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2116 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2117 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2118 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2119 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2120 | /* Enable all DACs */ |
| 2121 | /* DAC DISABLE/MUTE 1? */ |
| 2122 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2123 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2124 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2125 | /* DAC DISABLE/MUTE 2? */ |
| 2126 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2127 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2128 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2129 | /* DMIC fix |
| 2130 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2131 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2132 | * makes the signal become a difference/sum signal instead of standard |
| 2133 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2134 | * codec replicate the sum signal to both channels, turning it into a |
| 2135 | * normal mono mic. |
| 2136 | */ |
| 2137 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2138 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2139 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2140 | { } |
| 2141 | }; |
| 2142 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2143 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2144 | /* Front mic only available on one ADC */ |
| 2145 | { |
| 2146 | .num_items = 4, |
| 2147 | .items = { |
| 2148 | { "Mic", 0x0 }, |
| 2149 | { "Line", 0x2 }, |
| 2150 | { "CD", 0x4 }, |
| 2151 | { "Front Mic", 0xb }, |
| 2152 | }, |
| 2153 | }, |
| 2154 | { |
| 2155 | .num_items = 3, |
| 2156 | .items = { |
| 2157 | { "Mic", 0x0 }, |
| 2158 | { "Line", 0x2 }, |
| 2159 | { "CD", 0x4 }, |
| 2160 | }, |
| 2161 | } |
| 2162 | }; |
| 2163 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2164 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2165 | /* Interal mic only available on one ADC */ |
| 2166 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2167 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2168 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2169 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2170 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2171 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2172 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2173 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2174 | }, |
| 2175 | }, |
| 2176 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2177 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2178 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2179 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2180 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2181 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2182 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2183 | }, |
| 2184 | } |
| 2185 | }; |
| 2186 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2187 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2188 | /* Digital mic only available on first "ADC" */ |
| 2189 | { |
| 2190 | .num_items = 5, |
| 2191 | .items = { |
| 2192 | { "Mic", 0x0 }, |
| 2193 | { "Line", 0x2 }, |
| 2194 | { "CD", 0x4 }, |
| 2195 | { "Front Mic", 0xb }, |
| 2196 | { "Input Mix", 0xa }, |
| 2197 | }, |
| 2198 | }, |
| 2199 | { |
| 2200 | .num_items = 4, |
| 2201 | .items = { |
| 2202 | { "Mic", 0x0 }, |
| 2203 | { "Line", 0x2 }, |
| 2204 | { "CD", 0x4 }, |
| 2205 | { "Input Mix", 0xa }, |
| 2206 | }, |
| 2207 | }, |
| 2208 | { |
| 2209 | .num_items = 4, |
| 2210 | .items = { |
| 2211 | { "Mic", 0x0 }, |
| 2212 | { "Line", 0x2 }, |
| 2213 | { "CD", 0x4 }, |
| 2214 | { "Input Mix", 0xa }, |
| 2215 | }, |
| 2216 | } |
| 2217 | }; |
| 2218 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2219 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2220 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2221 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2222 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2223 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2224 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2225 | HDA_OUTPUT), |
| 2226 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2227 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2228 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2229 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2230 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2231 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2232 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2233 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2234 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2235 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2236 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2237 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2238 | { } /* end */ |
| 2239 | }; |
| 2240 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2241 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2242 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2243 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2244 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2245 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2246 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2247 | HDA_OUTPUT), |
| 2248 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2249 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2250 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2251 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2252 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2254 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2255 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2256 | { } /* end */ |
| 2257 | }; |
| 2258 | |
| 2259 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2260 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2261 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2262 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x15; |
| 2265 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2266 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2267 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2268 | } |
| 2269 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2270 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2271 | { |
| 2272 | struct alc_spec *spec = codec->spec; |
| 2273 | |
| 2274 | spec->autocfg.hp_pins[0] = 0x15; |
| 2275 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2276 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2277 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2278 | } |
| 2279 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2280 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2281 | { |
| 2282 | struct alc_spec *spec = codec->spec; |
| 2283 | |
| 2284 | spec->autocfg.hp_pins[0] = 0x15; |
| 2285 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2286 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2287 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2288 | } |
| 2289 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2290 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2291 | { |
| 2292 | struct alc_spec *spec = codec->spec; |
| 2293 | |
| 2294 | spec->autocfg.hp_pins[0] = 0x15; |
| 2295 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2296 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2297 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2298 | } |
| 2299 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2300 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2301 | * ALC880 3-stack model |
| 2302 | * |
| 2303 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2304 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2305 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2306 | */ |
| 2307 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2308 | static hda_nid_t alc880_dac_nids[4] = { |
| 2309 | /* front, rear, clfe, rear_surr */ |
| 2310 | 0x02, 0x05, 0x04, 0x03 |
| 2311 | }; |
| 2312 | |
| 2313 | static hda_nid_t alc880_adc_nids[3] = { |
| 2314 | /* ADC0-2 */ |
| 2315 | 0x07, 0x08, 0x09, |
| 2316 | }; |
| 2317 | |
| 2318 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2319 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2320 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2321 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2322 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2323 | /* ADC1-2 */ |
| 2324 | 0x08, 0x09, |
| 2325 | }; |
| 2326 | |
| 2327 | #define ALC880_DIGOUT_NID 0x06 |
| 2328 | #define ALC880_DIGIN_NID 0x0a |
| 2329 | |
| 2330 | static struct hda_input_mux alc880_capture_source = { |
| 2331 | .num_items = 4, |
| 2332 | .items = { |
| 2333 | { "Mic", 0x0 }, |
| 2334 | { "Front Mic", 0x3 }, |
| 2335 | { "Line", 0x2 }, |
| 2336 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2337 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2338 | }; |
| 2339 | |
| 2340 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2341 | /* 2ch mode */ |
| 2342 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2343 | /* set line-in to input, mute it */ |
| 2344 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2345 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2346 | /* set mic-in to input vref 80%, mute it */ |
| 2347 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2348 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2349 | { } /* end */ |
| 2350 | }; |
| 2351 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2352 | /* 6ch mode */ |
| 2353 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2354 | /* set line-in to output, unmute it */ |
| 2355 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2356 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2357 | /* set mic-in to output, unmute it */ |
| 2358 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2359 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2360 | { } /* end */ |
| 2361 | }; |
| 2362 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2363 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2364 | { 2, alc880_threestack_ch2_init }, |
| 2365 | { 6, alc880_threestack_ch6_init }, |
| 2366 | }; |
| 2367 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2368 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2369 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2370 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2371 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2372 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2373 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2374 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2375 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2376 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2377 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2378 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2379 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2380 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2381 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2382 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2383 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2384 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2385 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2386 | { |
| 2387 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2388 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2389 | .info = alc_ch_mode_info, |
| 2390 | .get = alc_ch_mode_get, |
| 2391 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2392 | }, |
| 2393 | { } /* end */ |
| 2394 | }; |
| 2395 | |
| 2396 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2397 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2398 | struct snd_ctl_elem_info *uinfo) |
| 2399 | { |
| 2400 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2401 | struct alc_spec *spec = codec->spec; |
| 2402 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2403 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2404 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2405 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2406 | HDA_INPUT); |
| 2407 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2408 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2409 | return err; |
| 2410 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2411 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2412 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2413 | unsigned int size, unsigned int __user *tlv) |
| 2414 | { |
| 2415 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2416 | struct alc_spec *spec = codec->spec; |
| 2417 | int err; |
| 2418 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2419 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2420 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2421 | HDA_INPUT); |
| 2422 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2423 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2424 | return err; |
| 2425 | } |
| 2426 | |
| 2427 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2428 | struct snd_ctl_elem_value *ucontrol); |
| 2429 | |
| 2430 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2431 | struct snd_ctl_elem_value *ucontrol, |
| 2432 | getput_call_t func) |
| 2433 | { |
| 2434 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2435 | struct alc_spec *spec = codec->spec; |
| 2436 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2437 | int err; |
| 2438 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2439 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2440 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2441 | 3, 0, HDA_INPUT); |
| 2442 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2443 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2444 | return err; |
| 2445 | } |
| 2446 | |
| 2447 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2448 | struct snd_ctl_elem_value *ucontrol) |
| 2449 | { |
| 2450 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2451 | snd_hda_mixer_amp_volume_get); |
| 2452 | } |
| 2453 | |
| 2454 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2455 | struct snd_ctl_elem_value *ucontrol) |
| 2456 | { |
| 2457 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2458 | snd_hda_mixer_amp_volume_put); |
| 2459 | } |
| 2460 | |
| 2461 | /* capture mixer elements */ |
| 2462 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2463 | |
| 2464 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2465 | struct snd_ctl_elem_value *ucontrol) |
| 2466 | { |
| 2467 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2468 | snd_hda_mixer_amp_switch_get); |
| 2469 | } |
| 2470 | |
| 2471 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2472 | struct snd_ctl_elem_value *ucontrol) |
| 2473 | { |
| 2474 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2475 | snd_hda_mixer_amp_switch_put); |
| 2476 | } |
| 2477 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2478 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2479 | { \ |
| 2480 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2481 | .name = "Capture Switch", \ |
| 2482 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2483 | .count = num, \ |
| 2484 | .info = alc_cap_sw_info, \ |
| 2485 | .get = alc_cap_sw_get, \ |
| 2486 | .put = alc_cap_sw_put, \ |
| 2487 | }, \ |
| 2488 | { \ |
| 2489 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2490 | .name = "Capture Volume", \ |
| 2491 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2492 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2493 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2494 | .count = num, \ |
| 2495 | .info = alc_cap_vol_info, \ |
| 2496 | .get = alc_cap_vol_get, \ |
| 2497 | .put = alc_cap_vol_put, \ |
| 2498 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2499 | } |
| 2500 | |
| 2501 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2502 | { \ |
| 2503 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2504 | /* .name = "Capture Source", */ \ |
| 2505 | .name = "Input Source", \ |
| 2506 | .count = num, \ |
| 2507 | .info = alc_mux_enum_info, \ |
| 2508 | .get = alc_mux_enum_get, \ |
| 2509 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2510 | } |
| 2511 | |
| 2512 | #define DEFINE_CAPMIX(num) \ |
| 2513 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2514 | _DEFINE_CAPMIX(num), \ |
| 2515 | _DEFINE_CAPSRC(num), \ |
| 2516 | { } /* end */ \ |
| 2517 | } |
| 2518 | |
| 2519 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2520 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2521 | _DEFINE_CAPMIX(num), \ |
| 2522 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2523 | } |
| 2524 | |
| 2525 | /* up to three ADCs */ |
| 2526 | DEFINE_CAPMIX(1); |
| 2527 | DEFINE_CAPMIX(2); |
| 2528 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2529 | DEFINE_CAPMIX_NOSRC(1); |
| 2530 | DEFINE_CAPMIX_NOSRC(2); |
| 2531 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2532 | |
| 2533 | /* |
| 2534 | * ALC880 5-stack model |
| 2535 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2536 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2537 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2538 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2539 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2540 | */ |
| 2541 | |
| 2542 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2543 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2544 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2545 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2546 | { } /* end */ |
| 2547 | }; |
| 2548 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2549 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2550 | /* 6ch mode */ |
| 2551 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2552 | /* set line-in to input, mute it */ |
| 2553 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2554 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2555 | { } /* end */ |
| 2556 | }; |
| 2557 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2558 | /* 8ch mode */ |
| 2559 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2560 | /* set line-in to output, unmute it */ |
| 2561 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2562 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2563 | { } /* end */ |
| 2564 | }; |
| 2565 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2566 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2567 | { 6, alc880_fivestack_ch6_init }, |
| 2568 | { 8, alc880_fivestack_ch8_init }, |
| 2569 | }; |
| 2570 | |
| 2571 | |
| 2572 | /* |
| 2573 | * ALC880 6-stack model |
| 2574 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2575 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2576 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2577 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2578 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2579 | */ |
| 2580 | |
| 2581 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2582 | /* front, rear, clfe, rear_surr */ |
| 2583 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2584 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2585 | |
| 2586 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2587 | .num_items = 4, |
| 2588 | .items = { |
| 2589 | { "Mic", 0x0 }, |
| 2590 | { "Front Mic", 0x1 }, |
| 2591 | { "Line", 0x2 }, |
| 2592 | { "CD", 0x4 }, |
| 2593 | }, |
| 2594 | }; |
| 2595 | |
| 2596 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2597 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2598 | { 8, NULL }, |
| 2599 | }; |
| 2600 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2601 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2602 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2603 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2604 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2605 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2606 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2607 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2608 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2609 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2610 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2611 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2612 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2613 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2614 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2615 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2616 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2617 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2618 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2619 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2620 | { |
| 2621 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2622 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2623 | .info = alc_ch_mode_info, |
| 2624 | .get = alc_ch_mode_get, |
| 2625 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2626 | }, |
| 2627 | { } /* end */ |
| 2628 | }; |
| 2629 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2630 | |
| 2631 | /* |
| 2632 | * ALC880 W810 model |
| 2633 | * |
| 2634 | * W810 has rear IO for: |
| 2635 | * Front (DAC 02) |
| 2636 | * Surround (DAC 03) |
| 2637 | * Center/LFE (DAC 04) |
| 2638 | * Digital out (06) |
| 2639 | * |
| 2640 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2641 | * 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] | 2642 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2643 | * There is a variable resistor to control the speaker or headphone |
| 2644 | * volume. This is a hardware-only device without a software API. |
| 2645 | * |
| 2646 | * Plugging headphones in will disable the internal speakers. This is |
| 2647 | * implemented in hardware, not via the driver using jack sense. In |
| 2648 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2649 | * disable both the speakers and headphones. |
| 2650 | * |
| 2651 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2652 | * These may not do anything useful with this driver yet, because I |
| 2653 | * haven't setup any initialization verbs for these yet... |
| 2654 | */ |
| 2655 | |
| 2656 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2657 | /* front, rear/surround, clfe */ |
| 2658 | 0x02, 0x03, 0x04 |
| 2659 | }; |
| 2660 | |
| 2661 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2662 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2663 | { 6, NULL } |
| 2664 | }; |
| 2665 | |
| 2666 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2667 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2668 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2669 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2670 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2671 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2672 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2673 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2674 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2675 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2676 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2677 | { } /* end */ |
| 2678 | }; |
| 2679 | |
| 2680 | |
| 2681 | /* |
| 2682 | * Z710V model |
| 2683 | * |
| 2684 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2685 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2686 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2687 | */ |
| 2688 | |
| 2689 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2690 | 0x02 |
| 2691 | }; |
| 2692 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2693 | |
| 2694 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2695 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2696 | { 2, NULL } |
| 2697 | }; |
| 2698 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2699 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2700 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2701 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2702 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2703 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2704 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2705 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2708 | { } /* end */ |
| 2709 | }; |
| 2710 | |
| 2711 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2712 | /* |
| 2713 | * ALC880 F1734 model |
| 2714 | * |
| 2715 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2716 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2717 | */ |
| 2718 | |
| 2719 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2720 | 0x03 |
| 2721 | }; |
| 2722 | #define ALC880_F1734_HP_DAC 0x02 |
| 2723 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2724 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2725 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2726 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2727 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2728 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2729 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2730 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2732 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2733 | { } /* end */ |
| 2734 | }; |
| 2735 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2736 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2737 | .num_items = 2, |
| 2738 | .items = { |
| 2739 | { "Mic", 0x1 }, |
| 2740 | { "CD", 0x4 }, |
| 2741 | }, |
| 2742 | }; |
| 2743 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2744 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2745 | /* |
| 2746 | * ALC880 ASUS model |
| 2747 | * |
| 2748 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2749 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2750 | * Mic = 0x18, Line = 0x1a |
| 2751 | */ |
| 2752 | |
| 2753 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2754 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2755 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2756 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2757 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2758 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2759 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2760 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2761 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2762 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2763 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2764 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2765 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2766 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2767 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2768 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2769 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2770 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2771 | { |
| 2772 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2773 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2774 | .info = alc_ch_mode_info, |
| 2775 | .get = alc_ch_mode_get, |
| 2776 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2777 | }, |
| 2778 | { } /* end */ |
| 2779 | }; |
| 2780 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2781 | /* |
| 2782 | * ALC880 ASUS W1V model |
| 2783 | * |
| 2784 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2785 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2786 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2787 | */ |
| 2788 | |
| 2789 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2790 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2791 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2792 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2793 | { } /* end */ |
| 2794 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2795 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2796 | /* TCL S700 */ |
| 2797 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2798 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2799 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2800 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2801 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2802 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2805 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2806 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2807 | { } /* end */ |
| 2808 | }; |
| 2809 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2810 | /* Uniwill */ |
| 2811 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2812 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2813 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2814 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2815 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2816 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2817 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2818 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2819 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2820 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2821 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2822 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2823 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2824 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2825 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2826 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2827 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2828 | { |
| 2829 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2830 | .name = "Channel Mode", |
| 2831 | .info = alc_ch_mode_info, |
| 2832 | .get = alc_ch_mode_get, |
| 2833 | .put = alc_ch_mode_put, |
| 2834 | }, |
| 2835 | { } /* end */ |
| 2836 | }; |
| 2837 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2838 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2839 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2840 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2841 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2842 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2843 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2844 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2847 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2848 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2849 | { } /* end */ |
| 2850 | }; |
| 2851 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2852 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2853 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2854 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2855 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2856 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2857 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2858 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2859 | { } /* end */ |
| 2860 | }; |
| 2861 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2862 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2863 | * virtual master controls |
| 2864 | */ |
| 2865 | |
| 2866 | /* |
| 2867 | * slave controls for virtual master |
| 2868 | */ |
| 2869 | static const char *alc_slave_vols[] = { |
| 2870 | "Front Playback Volume", |
| 2871 | "Surround Playback Volume", |
| 2872 | "Center Playback Volume", |
| 2873 | "LFE Playback Volume", |
| 2874 | "Side Playback Volume", |
| 2875 | "Headphone Playback Volume", |
| 2876 | "Speaker Playback Volume", |
| 2877 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2878 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2879 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2880 | NULL, |
| 2881 | }; |
| 2882 | |
| 2883 | static const char *alc_slave_sws[] = { |
| 2884 | "Front Playback Switch", |
| 2885 | "Surround Playback Switch", |
| 2886 | "Center Playback Switch", |
| 2887 | "LFE Playback Switch", |
| 2888 | "Side Playback Switch", |
| 2889 | "Headphone Playback Switch", |
| 2890 | "Speaker Playback Switch", |
| 2891 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2892 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2893 | "Line-Out Playback Switch", |
| 2894 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2895 | NULL, |
| 2896 | }; |
| 2897 | |
| 2898 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2899 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2900 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2901 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2902 | #define NID_MAPPING (-1) |
| 2903 | |
| 2904 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2905 | #define SUBDEV_HP_ (1 << 6) |
| 2906 | #define SUBDEV_LINE_ (2 << 6) |
| 2907 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2908 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2909 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2910 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2911 | static void alc_free_kctls(struct hda_codec *codec); |
| 2912 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2913 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2914 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2915 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2916 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2917 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2918 | { } /* end */ |
| 2919 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2920 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2921 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2922 | static int alc_build_controls(struct hda_codec *codec) |
| 2923 | { |
| 2924 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2925 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2926 | struct snd_kcontrol_new *knew; |
| 2927 | int i, j, err; |
| 2928 | unsigned int u; |
| 2929 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2930 | |
| 2931 | for (i = 0; i < spec->num_mixers; i++) { |
| 2932 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2933 | if (err < 0) |
| 2934 | return err; |
| 2935 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2936 | if (spec->cap_mixer) { |
| 2937 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2938 | if (err < 0) |
| 2939 | return err; |
| 2940 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2941 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2942 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2943 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2944 | if (err < 0) |
| 2945 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2946 | if (!spec->no_analog) { |
| 2947 | err = snd_hda_create_spdif_share_sw(codec, |
| 2948 | &spec->multiout); |
| 2949 | if (err < 0) |
| 2950 | return err; |
| 2951 | spec->multiout.share_spdif = 1; |
| 2952 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2953 | } |
| 2954 | if (spec->dig_in_nid) { |
| 2955 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2956 | if (err < 0) |
| 2957 | return err; |
| 2958 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2959 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2960 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2961 | /* create beep controls if needed */ |
| 2962 | if (spec->beep_amp) { |
| 2963 | struct snd_kcontrol_new *knew; |
| 2964 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2965 | struct snd_kcontrol *kctl; |
| 2966 | kctl = snd_ctl_new1(knew, codec); |
| 2967 | if (!kctl) |
| 2968 | return -ENOMEM; |
| 2969 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2970 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2971 | if (err < 0) |
| 2972 | return err; |
| 2973 | } |
| 2974 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2975 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2976 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2977 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2978 | if (!spec->no_analog && |
| 2979 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2980 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2981 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2982 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2983 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2984 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2985 | if (err < 0) |
| 2986 | return err; |
| 2987 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2988 | if (!spec->no_analog && |
| 2989 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2990 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2991 | NULL, alc_slave_sws); |
| 2992 | if (err < 0) |
| 2993 | return err; |
| 2994 | } |
| 2995 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2996 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2997 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2998 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2999 | if (!kctl) |
| 3000 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3001 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3002 | hda_nid_t *nids = spec->capsrc_nids; |
| 3003 | if (!nids) |
| 3004 | nids = spec->adc_nids; |
| 3005 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3006 | if (err < 0) |
| 3007 | return err; |
| 3008 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3009 | } |
| 3010 | if (spec->cap_mixer) { |
| 3011 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3012 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3013 | if (kname && strcmp(knew->name, kname) == 0) |
| 3014 | continue; |
| 3015 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3016 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3017 | err = snd_hda_add_nid(codec, kctl, i, |
| 3018 | spec->adc_nids[i]); |
| 3019 | if (err < 0) |
| 3020 | return err; |
| 3021 | } |
| 3022 | } |
| 3023 | } |
| 3024 | |
| 3025 | /* other nid->control mapping */ |
| 3026 | for (i = 0; i < spec->num_mixers; i++) { |
| 3027 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3028 | if (knew->iface != NID_MAPPING) |
| 3029 | continue; |
| 3030 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3031 | if (kctl == NULL) |
| 3032 | continue; |
| 3033 | u = knew->subdevice; |
| 3034 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3035 | nid = u & 0x3f; |
| 3036 | if (nid == 0) |
| 3037 | continue; |
| 3038 | switch (u & 0xc0) { |
| 3039 | case SUBDEV_SPEAKER_: |
| 3040 | nid = spec->autocfg.speaker_pins[nid]; |
| 3041 | break; |
| 3042 | case SUBDEV_LINE_: |
| 3043 | nid = spec->autocfg.line_out_pins[nid]; |
| 3044 | break; |
| 3045 | case SUBDEV_HP_: |
| 3046 | nid = spec->autocfg.hp_pins[nid]; |
| 3047 | break; |
| 3048 | default: |
| 3049 | continue; |
| 3050 | } |
| 3051 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3052 | if (err < 0) |
| 3053 | return err; |
| 3054 | } |
| 3055 | u = knew->private_value; |
| 3056 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3057 | nid = u & 0xff; |
| 3058 | if (nid == 0) |
| 3059 | continue; |
| 3060 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3061 | if (err < 0) |
| 3062 | return err; |
| 3063 | } |
| 3064 | } |
| 3065 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3066 | |
| 3067 | alc_free_kctls(codec); /* no longer needed */ |
| 3068 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3069 | return 0; |
| 3070 | } |
| 3071 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3072 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3073 | /* |
| 3074 | * initialize the codec volumes, etc |
| 3075 | */ |
| 3076 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3077 | /* |
| 3078 | * generic initialization of ADC, input mixers and output mixers |
| 3079 | */ |
| 3080 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3081 | /* |
| 3082 | * Unmute ADC0-2 and set the default input to mic-in |
| 3083 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3084 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3085 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3086 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3088 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3089 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3090 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3091 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3092 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3093 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3094 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3095 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3096 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3103 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3104 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3105 | /* |
| 3106 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3107 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3108 | /* set vol=0 to output mixers */ |
| 3109 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3110 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3111 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3112 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3113 | /* set up input amps for analog loopback */ |
| 3114 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3117 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3118 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3119 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3120 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3121 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3122 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3123 | |
| 3124 | { } |
| 3125 | }; |
| 3126 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3127 | /* |
| 3128 | * 3-stack pin configuration: |
| 3129 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3130 | */ |
| 3131 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3132 | /* |
| 3133 | * preset connection lists of input pins |
| 3134 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3135 | */ |
| 3136 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3137 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3138 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3139 | |
| 3140 | /* |
| 3141 | * Set pin mode and muting |
| 3142 | */ |
| 3143 | /* set front pin widgets 0x14 for output */ |
| 3144 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3145 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3146 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3147 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3148 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3149 | /* Mic2 (as headphone out) for HP output */ |
| 3150 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3151 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3152 | /* Line In pin widget for input */ |
| 3153 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3154 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3155 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3156 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3157 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3158 | /* CD pin widget for input */ |
| 3159 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3160 | |
| 3161 | { } |
| 3162 | }; |
| 3163 | |
| 3164 | /* |
| 3165 | * 5-stack pin configuration: |
| 3166 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3167 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3168 | */ |
| 3169 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3170 | /* |
| 3171 | * preset connection lists of input pins |
| 3172 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3173 | */ |
| 3174 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3175 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3176 | |
| 3177 | /* |
| 3178 | * Set pin mode and muting |
| 3179 | */ |
| 3180 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3181 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3182 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3183 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3184 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3185 | /* unmute pins for output (no gain on this amp) */ |
| 3186 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3187 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3188 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3189 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3190 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3191 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3192 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3193 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3194 | /* Mic2 (as headphone out) for HP output */ |
| 3195 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3196 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3197 | /* Line In pin widget for input */ |
| 3198 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3199 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3200 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3201 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3202 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3203 | /* CD pin widget for input */ |
| 3204 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3205 | |
| 3206 | { } |
| 3207 | }; |
| 3208 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3209 | /* |
| 3210 | * W810 pin configuration: |
| 3211 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3212 | */ |
| 3213 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3214 | /* hphone/speaker input selector: front DAC */ |
| 3215 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3216 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3218 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3219 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3220 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3221 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3222 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3223 | |
| 3224 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3225 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3226 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3227 | { } |
| 3228 | }; |
| 3229 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3230 | /* |
| 3231 | * Z71V pin configuration: |
| 3232 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3233 | */ |
| 3234 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3235 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3237 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3238 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3239 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3240 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3241 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3242 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3243 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3244 | |
| 3245 | { } |
| 3246 | }; |
| 3247 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3248 | /* |
| 3249 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3250 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3251 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3252 | */ |
| 3253 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3254 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3255 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3256 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3257 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3258 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3259 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3260 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3261 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3262 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3263 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3264 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3265 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3266 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3267 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3268 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3269 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3270 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3271 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3272 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3273 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3274 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3275 | { } |
| 3276 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3277 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3278 | /* |
| 3279 | * Uniwill pin configuration: |
| 3280 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3281 | * line = 0x1a |
| 3282 | */ |
| 3283 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3284 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3285 | |
| 3286 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3287 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3288 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3289 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3290 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3291 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3292 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3293 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3294 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3295 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3296 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3297 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3299 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3300 | |
| 3301 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3302 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3303 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3304 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3305 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3306 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3307 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3308 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3309 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3310 | |
| 3311 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3312 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3313 | |
| 3314 | { } |
| 3315 | }; |
| 3316 | |
| 3317 | /* |
| 3318 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3319 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3320 | */ |
| 3321 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3322 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3323 | |
| 3324 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3325 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3326 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3327 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3328 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3329 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3330 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3331 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3332 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3333 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3334 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3335 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3336 | |
| 3337 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3338 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3339 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3340 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3341 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3342 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3343 | |
| 3344 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3345 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3346 | |
| 3347 | { } |
| 3348 | }; |
| 3349 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3350 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3351 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3352 | { } |
| 3353 | }; |
| 3354 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3355 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3356 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3357 | { |
| 3358 | unsigned int present; |
| 3359 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3360 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3361 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3362 | bits = present ? HDA_AMP_MUTE : 0; |
| 3363 | 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] | 3364 | } |
| 3365 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3366 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3367 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3368 | struct alc_spec *spec = codec->spec; |
| 3369 | |
| 3370 | spec->autocfg.hp_pins[0] = 0x14; |
| 3371 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3372 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3373 | } |
| 3374 | |
| 3375 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3376 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3377 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3378 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3379 | } |
| 3380 | |
| 3381 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3382 | unsigned int res) |
| 3383 | { |
| 3384 | /* Looks like the unsol event is incompatible with the standard |
| 3385 | * definition. 4bit tag is placed at 28 bit! |
| 3386 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3387 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3388 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3389 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3390 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3391 | default: |
| 3392 | alc_automute_amp_unsol_event(codec, res); |
| 3393 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3394 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3395 | } |
| 3396 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3397 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3398 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3399 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x14; |
| 3402 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3403 | } |
| 3404 | |
| 3405 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3406 | { |
| 3407 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3408 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3409 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3410 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3411 | present &= HDA_AMP_VOLMASK; |
| 3412 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3413 | HDA_AMP_VOLMASK, present); |
| 3414 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3415 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3416 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3417 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3418 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3419 | unsigned int res) |
| 3420 | { |
| 3421 | /* Looks like the unsol event is incompatible with the standard |
| 3422 | * definition. 4bit tag is placed at 28 bit! |
| 3423 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3424 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3425 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3426 | else |
| 3427 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3428 | } |
| 3429 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3430 | /* |
| 3431 | * F1734 pin configuration: |
| 3432 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3433 | */ |
| 3434 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3435 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3436 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3437 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3438 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3439 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3440 | |
| 3441 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3442 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3443 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3444 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3445 | |
| 3446 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3447 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3448 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3449 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3450 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3451 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3452 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3453 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3454 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3455 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3456 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3457 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3458 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3459 | { } |
| 3460 | }; |
| 3461 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3462 | /* |
| 3463 | * ASUS pin configuration: |
| 3464 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3465 | */ |
| 3466 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3467 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3468 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3469 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3470 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3471 | |
| 3472 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3473 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3474 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3475 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3476 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3477 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3478 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3479 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3480 | |
| 3481 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3482 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3483 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3484 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3485 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3486 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3487 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3488 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3489 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3490 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3491 | { } |
| 3492 | }; |
| 3493 | |
| 3494 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3495 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3496 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3497 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3498 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3499 | /* Clevo m520g init */ |
| 3500 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3501 | /* headphone output */ |
| 3502 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3503 | /* line-out */ |
| 3504 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3506 | /* Line-in */ |
| 3507 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3508 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3509 | /* CD */ |
| 3510 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3511 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3512 | /* Mic1 (rear panel) */ |
| 3513 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3514 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3515 | /* Mic2 (front panel) */ |
| 3516 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3517 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3518 | /* headphone */ |
| 3519 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3520 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3521 | /* change to EAPD mode */ |
| 3522 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3523 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3524 | |
| 3525 | { } |
| 3526 | }; |
| 3527 | |
| 3528 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3529 | /* change to EAPD mode */ |
| 3530 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3531 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3532 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3533 | /* Headphone output */ |
| 3534 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3535 | /* Front output*/ |
| 3536 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3537 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3538 | |
| 3539 | /* Line In pin widget for input */ |
| 3540 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3541 | /* CD pin widget for input */ |
| 3542 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3543 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3544 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3545 | |
| 3546 | /* change to EAPD mode */ |
| 3547 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3548 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3549 | |
| 3550 | { } |
| 3551 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3552 | |
| 3553 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3554 | * LG m1 express dual |
| 3555 | * |
| 3556 | * Pin assignment: |
| 3557 | * Rear Line-In/Out (blue): 0x14 |
| 3558 | * Build-in Mic-In: 0x15 |
| 3559 | * Speaker-out: 0x17 |
| 3560 | * HP-Out (green): 0x1b |
| 3561 | * Mic-In/Out (red): 0x19 |
| 3562 | * SPDIF-Out: 0x1e |
| 3563 | */ |
| 3564 | |
| 3565 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3566 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3567 | 0x05, 0x02, 0x03 |
| 3568 | }; |
| 3569 | |
| 3570 | /* seems analog CD is not working */ |
| 3571 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3572 | .num_items = 3, |
| 3573 | .items = { |
| 3574 | { "Mic", 0x1 }, |
| 3575 | { "Line", 0x5 }, |
| 3576 | { "Internal Mic", 0x6 }, |
| 3577 | }, |
| 3578 | }; |
| 3579 | |
| 3580 | /* 2,4,6 channel modes */ |
| 3581 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3582 | /* set line-in and mic-in to input */ |
| 3583 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3584 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3585 | { } |
| 3586 | }; |
| 3587 | |
| 3588 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3589 | /* set line-in to out and mic-in to input */ |
| 3590 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3591 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3592 | { } |
| 3593 | }; |
| 3594 | |
| 3595 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3596 | /* set line-in and mic-in to output */ |
| 3597 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3598 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3599 | { } |
| 3600 | }; |
| 3601 | |
| 3602 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3603 | { 2, alc880_lg_ch2_init }, |
| 3604 | { 4, alc880_lg_ch4_init }, |
| 3605 | { 6, alc880_lg_ch6_init }, |
| 3606 | }; |
| 3607 | |
| 3608 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3609 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3610 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3611 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3612 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3613 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3614 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3615 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3616 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3617 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3618 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3619 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3620 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3621 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3622 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3623 | { |
| 3624 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3625 | .name = "Channel Mode", |
| 3626 | .info = alc_ch_mode_info, |
| 3627 | .get = alc_ch_mode_get, |
| 3628 | .put = alc_ch_mode_put, |
| 3629 | }, |
| 3630 | { } /* end */ |
| 3631 | }; |
| 3632 | |
| 3633 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3634 | /* set capture source to mic-in */ |
| 3635 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3636 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3637 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3638 | /* mute all amp mixer inputs */ |
| 3639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3642 | /* line-in to input */ |
| 3643 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3644 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3645 | /* built-in mic */ |
| 3646 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3647 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3648 | /* speaker-out */ |
| 3649 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3650 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3651 | /* mic-in to input */ |
| 3652 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3653 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3654 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3655 | /* HP-out */ |
| 3656 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3657 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3658 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3659 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3660 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3661 | { } |
| 3662 | }; |
| 3663 | |
| 3664 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3665 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3666 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3667 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3670 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3671 | } |
| 3672 | |
| 3673 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3674 | * LG LW20 |
| 3675 | * |
| 3676 | * Pin assignment: |
| 3677 | * Speaker-out: 0x14 |
| 3678 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3679 | * Built-in Mic-In: 0x19 |
| 3680 | * Line-In: 0x1b |
| 3681 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3682 | * SPDIF-Out: 0x1e |
| 3683 | */ |
| 3684 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3685 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3686 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3687 | .items = { |
| 3688 | { "Mic", 0x0 }, |
| 3689 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3690 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3691 | }, |
| 3692 | }; |
| 3693 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3694 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3695 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3696 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3697 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3698 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3699 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3700 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3701 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3702 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3703 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3704 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3705 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3706 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3709 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3710 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3711 | { |
| 3712 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3713 | .name = "Channel Mode", |
| 3714 | .info = alc_ch_mode_info, |
| 3715 | .get = alc_ch_mode_get, |
| 3716 | .put = alc_ch_mode_put, |
| 3717 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3718 | { } /* end */ |
| 3719 | }; |
| 3720 | |
| 3721 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3722 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3723 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3724 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3725 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3726 | /* set capture source to mic-in */ |
| 3727 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3728 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3729 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3730 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3731 | /* speaker-out */ |
| 3732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3733 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3734 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3735 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3736 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3737 | /* mic-in to input */ |
| 3738 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3739 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3740 | /* built-in mic */ |
| 3741 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3742 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3743 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3744 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3745 | { } |
| 3746 | }; |
| 3747 | |
| 3748 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3749 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3750 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3751 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3754 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3755 | } |
| 3756 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3757 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3758 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3759 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3760 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3761 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3762 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3763 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3764 | { } /* end */ |
| 3765 | }; |
| 3766 | |
| 3767 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3768 | .num_items = 2, |
| 3769 | .items = { |
| 3770 | { "Mic", 0x0 }, |
| 3771 | { "Internal Mic", 0x1 }, |
| 3772 | }, |
| 3773 | }; |
| 3774 | |
| 3775 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3776 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3777 | |
| 3778 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3779 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3780 | |
| 3781 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3782 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3783 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3784 | /* Mic2 (as headphone out) for HP output */ |
| 3785 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3786 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3787 | /* Internal Speaker */ |
| 3788 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3789 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3790 | |
| 3791 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3792 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3793 | |
| 3794 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3795 | { } |
| 3796 | }; |
| 3797 | |
| 3798 | /* toggle speaker-output according to the hp-jack state */ |
| 3799 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3800 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3801 | struct alc_spec *spec = codec->spec; |
| 3802 | alc_automute_amp(codec); |
| 3803 | /* toggle EAPD */ |
| 3804 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3805 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3806 | else |
| 3807 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3808 | } |
| 3809 | |
| 3810 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3811 | unsigned int res) |
| 3812 | { |
| 3813 | /* Looks like the unsol event is incompatible with the standard |
| 3814 | * definition. 4bit tag is placed at 28 bit! |
| 3815 | */ |
| 3816 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3817 | alc880_medion_rim_automute(codec); |
| 3818 | } |
| 3819 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3820 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3821 | { |
| 3822 | struct alc_spec *spec = codec->spec; |
| 3823 | |
| 3824 | spec->autocfg.hp_pins[0] = 0x14; |
| 3825 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3826 | } |
| 3827 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3828 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3829 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3830 | { 0x0b, HDA_INPUT, 0 }, |
| 3831 | { 0x0b, HDA_INPUT, 1 }, |
| 3832 | { 0x0b, HDA_INPUT, 2 }, |
| 3833 | { 0x0b, HDA_INPUT, 3 }, |
| 3834 | { 0x0b, HDA_INPUT, 4 }, |
| 3835 | { } /* end */ |
| 3836 | }; |
| 3837 | |
| 3838 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3839 | { 0x0b, HDA_INPUT, 1 }, |
| 3840 | { 0x0b, HDA_INPUT, 6 }, |
| 3841 | { 0x0b, HDA_INPUT, 7 }, |
| 3842 | { } /* end */ |
| 3843 | }; |
| 3844 | #endif |
| 3845 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3846 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3847 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3848 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3849 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3850 | static int alc_init(struct hda_codec *codec) |
| 3851 | { |
| 3852 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3853 | unsigned int i; |
| 3854 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3855 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3856 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3857 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3858 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3859 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3860 | |
| 3861 | if (spec->init_hook) |
| 3862 | spec->init_hook(codec); |
| 3863 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3864 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3865 | return 0; |
| 3866 | } |
| 3867 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3868 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3869 | { |
| 3870 | struct alc_spec *spec = codec->spec; |
| 3871 | |
| 3872 | if (spec->unsol_event) |
| 3873 | spec->unsol_event(codec, res); |
| 3874 | } |
| 3875 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3876 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3877 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3878 | { |
| 3879 | struct alc_spec *spec = codec->spec; |
| 3880 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3881 | } |
| 3882 | #endif |
| 3883 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3884 | /* |
| 3885 | * Analog playback callbacks |
| 3886 | */ |
| 3887 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3888 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3889 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3890 | { |
| 3891 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3892 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3893 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3894 | } |
| 3895 | |
| 3896 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3897 | struct hda_codec *codec, |
| 3898 | unsigned int stream_tag, |
| 3899 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3900 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3901 | { |
| 3902 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3903 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3904 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3905 | } |
| 3906 | |
| 3907 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3908 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3909 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3910 | { |
| 3911 | struct alc_spec *spec = codec->spec; |
| 3912 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3913 | } |
| 3914 | |
| 3915 | /* |
| 3916 | * Digital out |
| 3917 | */ |
| 3918 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3919 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3920 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3921 | { |
| 3922 | struct alc_spec *spec = codec->spec; |
| 3923 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3924 | } |
| 3925 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3926 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3927 | struct hda_codec *codec, |
| 3928 | unsigned int stream_tag, |
| 3929 | unsigned int format, |
| 3930 | struct snd_pcm_substream *substream) |
| 3931 | { |
| 3932 | struct alc_spec *spec = codec->spec; |
| 3933 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3934 | stream_tag, format, substream); |
| 3935 | } |
| 3936 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3937 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3938 | struct hda_codec *codec, |
| 3939 | struct snd_pcm_substream *substream) |
| 3940 | { |
| 3941 | struct alc_spec *spec = codec->spec; |
| 3942 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3943 | } |
| 3944 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3945 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3946 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3947 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3948 | { |
| 3949 | struct alc_spec *spec = codec->spec; |
| 3950 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3951 | } |
| 3952 | |
| 3953 | /* |
| 3954 | * Analog capture |
| 3955 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3956 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3957 | struct hda_codec *codec, |
| 3958 | unsigned int stream_tag, |
| 3959 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3960 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3961 | { |
| 3962 | struct alc_spec *spec = codec->spec; |
| 3963 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3964 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3965 | stream_tag, 0, format); |
| 3966 | return 0; |
| 3967 | } |
| 3968 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3969 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3970 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3971 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3972 | { |
| 3973 | struct alc_spec *spec = codec->spec; |
| 3974 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3975 | snd_hda_codec_cleanup_stream(codec, |
| 3976 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3977 | return 0; |
| 3978 | } |
| 3979 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 3980 | /* analog capture with dynamic dual-adc changes */ |
| 3981 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3982 | struct hda_codec *codec, |
| 3983 | unsigned int stream_tag, |
| 3984 | unsigned int format, |
| 3985 | struct snd_pcm_substream *substream) |
| 3986 | { |
| 3987 | struct alc_spec *spec = codec->spec; |
| 3988 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3989 | spec->cur_adc_stream_tag = stream_tag; |
| 3990 | spec->cur_adc_format = format; |
| 3991 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3992 | return 0; |
| 3993 | } |
| 3994 | |
| 3995 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3996 | struct hda_codec *codec, |
| 3997 | struct snd_pcm_substream *substream) |
| 3998 | { |
| 3999 | struct alc_spec *spec = codec->spec; |
| 4000 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4001 | spec->cur_adc = 0; |
| 4002 | return 0; |
| 4003 | } |
| 4004 | |
| 4005 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4006 | .substreams = 1, |
| 4007 | .channels_min = 2, |
| 4008 | .channels_max = 2, |
| 4009 | .nid = 0, /* fill later */ |
| 4010 | .ops = { |
| 4011 | .prepare = dualmic_capture_pcm_prepare, |
| 4012 | .cleanup = dualmic_capture_pcm_cleanup |
| 4013 | }, |
| 4014 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4015 | |
| 4016 | /* |
| 4017 | */ |
| 4018 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4019 | .substreams = 1, |
| 4020 | .channels_min = 2, |
| 4021 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4022 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4023 | .ops = { |
| 4024 | .open = alc880_playback_pcm_open, |
| 4025 | .prepare = alc880_playback_pcm_prepare, |
| 4026 | .cleanup = alc880_playback_pcm_cleanup |
| 4027 | }, |
| 4028 | }; |
| 4029 | |
| 4030 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4031 | .substreams = 1, |
| 4032 | .channels_min = 2, |
| 4033 | .channels_max = 2, |
| 4034 | /* NID is set in alc_build_pcms */ |
| 4035 | }; |
| 4036 | |
| 4037 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 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_capture = { |
| 4045 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4046 | .channels_min = 2, |
| 4047 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4048 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4049 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4050 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4051 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4052 | }, |
| 4053 | }; |
| 4054 | |
| 4055 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4056 | .substreams = 1, |
| 4057 | .channels_min = 2, |
| 4058 | .channels_max = 2, |
| 4059 | /* NID is set in alc_build_pcms */ |
| 4060 | .ops = { |
| 4061 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4062 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4063 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4064 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4065 | }, |
| 4066 | }; |
| 4067 | |
| 4068 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4069 | .substreams = 1, |
| 4070 | .channels_min = 2, |
| 4071 | .channels_max = 2, |
| 4072 | /* NID is set in alc_build_pcms */ |
| 4073 | }; |
| 4074 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4075 | /* 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] | 4076 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4077 | .substreams = 0, |
| 4078 | .channels_min = 0, |
| 4079 | .channels_max = 0, |
| 4080 | }; |
| 4081 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4082 | static int alc_build_pcms(struct hda_codec *codec) |
| 4083 | { |
| 4084 | struct alc_spec *spec = codec->spec; |
| 4085 | struct hda_pcm *info = spec->pcm_rec; |
| 4086 | int i; |
| 4087 | |
| 4088 | codec->num_pcms = 1; |
| 4089 | codec->pcm_info = info; |
| 4090 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4091 | if (spec->no_analog) |
| 4092 | goto skip_analog; |
| 4093 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4094 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4095 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4096 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4097 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4098 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4099 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4100 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4101 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4102 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4103 | } |
| 4104 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4105 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4106 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4107 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4108 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4109 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4110 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4111 | if (spec->channel_mode) { |
| 4112 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4113 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4114 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4115 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4116 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4117 | } |
| 4118 | } |
| 4119 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4120 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4121 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4122 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4123 | snprintf(spec->stream_name_digital, |
| 4124 | sizeof(spec->stream_name_digital), |
| 4125 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4126 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4127 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4128 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4129 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4130 | if (spec->dig_out_type) |
| 4131 | info->pcm_type = spec->dig_out_type; |
| 4132 | else |
| 4133 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4134 | if (spec->multiout.dig_out_nid && |
| 4135 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4136 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4137 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4138 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4139 | if (spec->dig_in_nid && |
| 4140 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4141 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4142 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4143 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4144 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4145 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4146 | } |
| 4147 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4148 | if (spec->no_analog) |
| 4149 | return 0; |
| 4150 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4151 | /* If the use of more than one ADC is requested for the current |
| 4152 | * model, configure a second analog capture-only PCM. |
| 4153 | */ |
| 4154 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4155 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4156 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4157 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4158 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4159 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4160 | if (spec->alt_dac_nid) { |
| 4161 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4162 | *spec->stream_analog_alt_playback; |
| 4163 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4164 | spec->alt_dac_nid; |
| 4165 | } else { |
| 4166 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4167 | alc_pcm_null_stream; |
| 4168 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4169 | } |
| 4170 | if (spec->num_adc_nids > 1) { |
| 4171 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4172 | *spec->stream_analog_alt_capture; |
| 4173 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4174 | spec->adc_nids[1]; |
| 4175 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4176 | spec->num_adc_nids - 1; |
| 4177 | } else { |
| 4178 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4179 | alc_pcm_null_stream; |
| 4180 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4181 | } |
| 4182 | } |
| 4183 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4184 | return 0; |
| 4185 | } |
| 4186 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4187 | static inline void alc_shutup(struct hda_codec *codec) |
| 4188 | { |
| 4189 | snd_hda_shutup_pins(codec); |
| 4190 | } |
| 4191 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4192 | static void alc_free_kctls(struct hda_codec *codec) |
| 4193 | { |
| 4194 | struct alc_spec *spec = codec->spec; |
| 4195 | |
| 4196 | if (spec->kctls.list) { |
| 4197 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4198 | int i; |
| 4199 | for (i = 0; i < spec->kctls.used; i++) |
| 4200 | kfree(kctl[i].name); |
| 4201 | } |
| 4202 | snd_array_free(&spec->kctls); |
| 4203 | } |
| 4204 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4205 | static void alc_free(struct hda_codec *codec) |
| 4206 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4207 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4208 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4209 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4210 | return; |
| 4211 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4212 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4213 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4214 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4215 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4216 | } |
| 4217 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4218 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4219 | static void alc_power_eapd(struct hda_codec *codec) |
| 4220 | { |
| 4221 | /* We currently only handle front, HP */ |
| 4222 | switch (codec->vendor_id) { |
| 4223 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4224 | set_eapd(codec, 0x0f, 0); |
| 4225 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4226 | break; |
| 4227 | case 0x10ec0262: |
| 4228 | case 0x10ec0267: |
| 4229 | case 0x10ec0268: |
| 4230 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4231 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4232 | case 0x10ec0272: |
| 4233 | case 0x10ec0660: |
| 4234 | case 0x10ec0662: |
| 4235 | case 0x10ec0663: |
| 4236 | case 0x10ec0862: |
| 4237 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4238 | set_eapd(codec, 0x14, 0); |
| 4239 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4240 | break; |
| 4241 | } |
| 4242 | } |
| 4243 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4244 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4245 | { |
| 4246 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4247 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4248 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4249 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4250 | return 0; |
| 4251 | } |
| 4252 | #endif |
| 4253 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4254 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4255 | static int alc_resume(struct hda_codec *codec) |
| 4256 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4257 | codec->patch_ops.init(codec); |
| 4258 | snd_hda_codec_resume_amp(codec); |
| 4259 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4260 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4261 | return 0; |
| 4262 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4263 | #endif |
| 4264 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4265 | /* |
| 4266 | */ |
| 4267 | static struct hda_codec_ops alc_patch_ops = { |
| 4268 | .build_controls = alc_build_controls, |
| 4269 | .build_pcms = alc_build_pcms, |
| 4270 | .init = alc_init, |
| 4271 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4272 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4273 | #ifdef SND_HDA_NEEDS_RESUME |
| 4274 | .resume = alc_resume, |
| 4275 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4276 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4277 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4278 | .check_power_status = alc_check_power_status, |
| 4279 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4280 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4281 | }; |
| 4282 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4283 | /* replace the codec chip_name with the given string */ |
| 4284 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4285 | { |
| 4286 | kfree(codec->chip_name); |
| 4287 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4288 | if (!codec->chip_name) { |
| 4289 | alc_free(codec); |
| 4290 | return -ENOMEM; |
| 4291 | } |
| 4292 | return 0; |
| 4293 | } |
| 4294 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4295 | /* |
| 4296 | * Test configuration for debugging |
| 4297 | * |
| 4298 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4299 | * enum controls. |
| 4300 | */ |
| 4301 | #ifdef CONFIG_SND_DEBUG |
| 4302 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4303 | 0x02, 0x03, 0x04, 0x05 |
| 4304 | }; |
| 4305 | |
| 4306 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4307 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4308 | .items = { |
| 4309 | { "In-1", 0x0 }, |
| 4310 | { "In-2", 0x1 }, |
| 4311 | { "In-3", 0x2 }, |
| 4312 | { "In-4", 0x3 }, |
| 4313 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4314 | { "Front", 0x5 }, |
| 4315 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4316 | }, |
| 4317 | }; |
| 4318 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4319 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4320 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4321 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4322 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4323 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4324 | }; |
| 4325 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4326 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4327 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4328 | { |
| 4329 | static char *texts[] = { |
| 4330 | "N/A", "Line Out", "HP Out", |
| 4331 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4332 | }; |
| 4333 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4334 | uinfo->count = 1; |
| 4335 | uinfo->value.enumerated.items = 8; |
| 4336 | if (uinfo->value.enumerated.item >= 8) |
| 4337 | uinfo->value.enumerated.item = 7; |
| 4338 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4339 | return 0; |
| 4340 | } |
| 4341 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4342 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4343 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4344 | { |
| 4345 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4346 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4347 | unsigned int pin_ctl, item = 0; |
| 4348 | |
| 4349 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4350 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4351 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4352 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4353 | item = 2; |
| 4354 | else |
| 4355 | item = 1; |
| 4356 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4357 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4358 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4359 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4360 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4361 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4362 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4363 | } |
| 4364 | } |
| 4365 | ucontrol->value.enumerated.item[0] = item; |
| 4366 | return 0; |
| 4367 | } |
| 4368 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4369 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4370 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4371 | { |
| 4372 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4373 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4374 | static unsigned int ctls[] = { |
| 4375 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4376 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4377 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4378 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4379 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4380 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4381 | }; |
| 4382 | unsigned int old_ctl, new_ctl; |
| 4383 | |
| 4384 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4385 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4386 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4387 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4388 | int val; |
| 4389 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4390 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4391 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4392 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4393 | HDA_AMP_MUTE : 0; |
| 4394 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4395 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4396 | return 1; |
| 4397 | } |
| 4398 | return 0; |
| 4399 | } |
| 4400 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4401 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4402 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4403 | { |
| 4404 | static char *texts[] = { |
| 4405 | "Front", "Surround", "CLFE", "Side" |
| 4406 | }; |
| 4407 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4408 | uinfo->count = 1; |
| 4409 | uinfo->value.enumerated.items = 4; |
| 4410 | if (uinfo->value.enumerated.item >= 4) |
| 4411 | uinfo->value.enumerated.item = 3; |
| 4412 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4413 | return 0; |
| 4414 | } |
| 4415 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4416 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4417 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4418 | { |
| 4419 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4420 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4421 | unsigned int sel; |
| 4422 | |
| 4423 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4424 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4425 | return 0; |
| 4426 | } |
| 4427 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4428 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4429 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4430 | { |
| 4431 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4432 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4433 | unsigned int sel; |
| 4434 | |
| 4435 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4436 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4437 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4438 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4439 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4440 | return 1; |
| 4441 | } |
| 4442 | return 0; |
| 4443 | } |
| 4444 | |
| 4445 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4446 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4447 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4448 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4449 | .info = alc_test_pin_ctl_info, \ |
| 4450 | .get = alc_test_pin_ctl_get, \ |
| 4451 | .put = alc_test_pin_ctl_put, \ |
| 4452 | .private_value = nid \ |
| 4453 | } |
| 4454 | |
| 4455 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4456 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4457 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4458 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4459 | .info = alc_test_pin_src_info, \ |
| 4460 | .get = alc_test_pin_src_get, \ |
| 4461 | .put = alc_test_pin_src_put, \ |
| 4462 | .private_value = nid \ |
| 4463 | } |
| 4464 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4465 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4466 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4467 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4468 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4469 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4470 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4471 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4472 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4473 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4474 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4475 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4476 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4477 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4478 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4479 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4480 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4481 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4482 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4483 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4484 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4485 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4486 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4487 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4488 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4489 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4490 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4491 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4492 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4493 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4494 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4495 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4496 | { |
| 4497 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4498 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4499 | .info = alc_ch_mode_info, |
| 4500 | .get = alc_ch_mode_get, |
| 4501 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4502 | }, |
| 4503 | { } /* end */ |
| 4504 | }; |
| 4505 | |
| 4506 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4507 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4508 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4509 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4510 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4511 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4512 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4513 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4514 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4515 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4516 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4518 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4519 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4520 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4521 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4522 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4523 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4524 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4525 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4526 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4527 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4528 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4529 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4530 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4531 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4532 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4533 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4534 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4535 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4536 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4537 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4538 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4539 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4540 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4541 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4542 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4543 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4544 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4545 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4546 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4547 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4548 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4549 | /* Analog input/passthru */ |
| 4550 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4551 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4552 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4553 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4554 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4555 | { } |
| 4556 | }; |
| 4557 | #endif |
| 4558 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4559 | /* |
| 4560 | */ |
| 4561 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4562 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4563 | [ALC880_3ST] = "3stack", |
| 4564 | [ALC880_TCL_S700] = "tcl", |
| 4565 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4566 | [ALC880_CLEVO] = "clevo", |
| 4567 | [ALC880_5ST] = "5stack", |
| 4568 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4569 | [ALC880_W810] = "w810", |
| 4570 | [ALC880_Z71V] = "z71v", |
| 4571 | [ALC880_6ST] = "6stack", |
| 4572 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4573 | [ALC880_ASUS] = "asus", |
| 4574 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4575 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4576 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4577 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4578 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4579 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4580 | [ALC880_F1734] = "F1734", |
| 4581 | [ALC880_LG] = "lg", |
| 4582 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4583 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4584 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4585 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4586 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4587 | [ALC880_AUTO] = "auto", |
| 4588 | }; |
| 4589 | |
| 4590 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4591 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4592 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4593 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4594 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4595 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4596 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4597 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4598 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4599 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4600 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4601 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4602 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4603 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4604 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4605 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4606 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4607 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4608 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4609 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4610 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4611 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4612 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4613 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4614 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4615 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4616 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4617 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4618 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4619 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4620 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4621 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4622 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4623 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4624 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4625 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4626 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4627 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4628 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4629 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4630 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4631 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4632 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4633 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4634 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4635 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4636 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4637 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4638 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4639 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4640 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4641 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4642 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4643 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4644 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4645 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4646 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4647 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4648 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4649 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4650 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4651 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4652 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4653 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4654 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4655 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4656 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4657 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4658 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4659 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4660 | /* default Intel */ |
| 4661 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4662 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4663 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4664 | {} |
| 4665 | }; |
| 4666 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4667 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4668 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4669 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4670 | static struct alc_config_preset alc880_presets[] = { |
| 4671 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4672 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4673 | .init_verbs = { alc880_volume_init_verbs, |
| 4674 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4675 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4676 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4677 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4678 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4679 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4680 | .input_mux = &alc880_capture_source, |
| 4681 | }, |
| 4682 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4683 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4684 | .init_verbs = { alc880_volume_init_verbs, |
| 4685 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4686 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4687 | .dac_nids = alc880_dac_nids, |
| 4688 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4689 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4690 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4691 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4692 | .input_mux = &alc880_capture_source, |
| 4693 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4694 | [ALC880_TCL_S700] = { |
| 4695 | .mixers = { alc880_tcl_s700_mixer }, |
| 4696 | .init_verbs = { alc880_volume_init_verbs, |
| 4697 | alc880_pin_tcl_S700_init_verbs, |
| 4698 | alc880_gpio2_init_verbs }, |
| 4699 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4700 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4701 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4702 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4703 | .hp_nid = 0x03, |
| 4704 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4705 | .channel_mode = alc880_2_jack_modes, |
| 4706 | .input_mux = &alc880_capture_source, |
| 4707 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4708 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4709 | .mixers = { alc880_three_stack_mixer, |
| 4710 | alc880_five_stack_mixer}, |
| 4711 | .init_verbs = { alc880_volume_init_verbs, |
| 4712 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4713 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4714 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4715 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4716 | .channel_mode = alc880_fivestack_modes, |
| 4717 | .input_mux = &alc880_capture_source, |
| 4718 | }, |
| 4719 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4720 | .mixers = { alc880_three_stack_mixer, |
| 4721 | alc880_five_stack_mixer }, |
| 4722 | .init_verbs = { alc880_volume_init_verbs, |
| 4723 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4724 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4725 | .dac_nids = alc880_dac_nids, |
| 4726 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4727 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4728 | .channel_mode = alc880_fivestack_modes, |
| 4729 | .input_mux = &alc880_capture_source, |
| 4730 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4731 | [ALC880_6ST] = { |
| 4732 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4733 | .init_verbs = { alc880_volume_init_verbs, |
| 4734 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4735 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4736 | .dac_nids = alc880_6st_dac_nids, |
| 4737 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4738 | .channel_mode = alc880_sixstack_modes, |
| 4739 | .input_mux = &alc880_6stack_capture_source, |
| 4740 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4741 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4742 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4743 | .init_verbs = { alc880_volume_init_verbs, |
| 4744 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4745 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4746 | .dac_nids = alc880_6st_dac_nids, |
| 4747 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4748 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4749 | .channel_mode = alc880_sixstack_modes, |
| 4750 | .input_mux = &alc880_6stack_capture_source, |
| 4751 | }, |
| 4752 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4753 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4754 | .init_verbs = { alc880_volume_init_verbs, |
| 4755 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4756 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4757 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4758 | .dac_nids = alc880_w810_dac_nids, |
| 4759 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4760 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4761 | .channel_mode = alc880_w810_modes, |
| 4762 | .input_mux = &alc880_capture_source, |
| 4763 | }, |
| 4764 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4765 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4766 | .init_verbs = { alc880_volume_init_verbs, |
| 4767 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4768 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4769 | .dac_nids = alc880_z71v_dac_nids, |
| 4770 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4771 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4772 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4773 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4774 | .input_mux = &alc880_capture_source, |
| 4775 | }, |
| 4776 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4777 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4778 | .init_verbs = { alc880_volume_init_verbs, |
| 4779 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4780 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4781 | .dac_nids = alc880_f1734_dac_nids, |
| 4782 | .hp_nid = 0x02, |
| 4783 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4784 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4785 | .input_mux = &alc880_f1734_capture_source, |
| 4786 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4787 | .setup = alc880_uniwill_p53_setup, |
| 4788 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4789 | }, |
| 4790 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4791 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4792 | .init_verbs = { alc880_volume_init_verbs, |
| 4793 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4794 | alc880_gpio1_init_verbs }, |
| 4795 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4796 | .dac_nids = alc880_asus_dac_nids, |
| 4797 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4798 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4799 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4800 | .input_mux = &alc880_capture_source, |
| 4801 | }, |
| 4802 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4803 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4804 | .init_verbs = { alc880_volume_init_verbs, |
| 4805 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4806 | alc880_gpio1_init_verbs }, |
| 4807 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4808 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4809 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4810 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4811 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4812 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4813 | .input_mux = &alc880_capture_source, |
| 4814 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4815 | [ALC880_ASUS_DIG2] = { |
| 4816 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4817 | .init_verbs = { alc880_volume_init_verbs, |
| 4818 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4819 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4820 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4821 | .dac_nids = alc880_asus_dac_nids, |
| 4822 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4823 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4824 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4825 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4826 | .input_mux = &alc880_capture_source, |
| 4827 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4828 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4829 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4830 | .init_verbs = { alc880_volume_init_verbs, |
| 4831 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4832 | alc880_gpio1_init_verbs }, |
| 4833 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4834 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4835 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4836 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4837 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4838 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4839 | .input_mux = &alc880_capture_source, |
| 4840 | }, |
| 4841 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4842 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4843 | .init_verbs = { alc880_volume_init_verbs, |
| 4844 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4845 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4846 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4847 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4848 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4849 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4850 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4851 | .input_mux = &alc880_capture_source, |
| 4852 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4853 | [ALC880_UNIWILL] = { |
| 4854 | .mixers = { alc880_uniwill_mixer }, |
| 4855 | .init_verbs = { alc880_volume_init_verbs, |
| 4856 | alc880_uniwill_init_verbs }, |
| 4857 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4858 | .dac_nids = alc880_asus_dac_nids, |
| 4859 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4860 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4861 | .channel_mode = alc880_threestack_modes, |
| 4862 | .need_dac_fix = 1, |
| 4863 | .input_mux = &alc880_capture_source, |
| 4864 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4865 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4866 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4867 | }, |
| 4868 | [ALC880_UNIWILL_P53] = { |
| 4869 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4870 | .init_verbs = { alc880_volume_init_verbs, |
| 4871 | alc880_uniwill_p53_init_verbs }, |
| 4872 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4873 | .dac_nids = alc880_asus_dac_nids, |
| 4874 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4875 | .channel_mode = alc880_threestack_modes, |
| 4876 | .input_mux = &alc880_capture_source, |
| 4877 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4878 | .setup = alc880_uniwill_p53_setup, |
| 4879 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4880 | }, |
| 4881 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4882 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4883 | .init_verbs = { alc880_volume_init_verbs, |
| 4884 | alc880_uniwill_p53_init_verbs, |
| 4885 | alc880_beep_init_verbs }, |
| 4886 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4887 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4888 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4889 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4890 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4891 | .input_mux = &alc880_capture_source, |
| 4892 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4893 | .setup = alc880_uniwill_p53_setup, |
| 4894 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4895 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4896 | [ALC880_CLEVO] = { |
| 4897 | .mixers = { alc880_three_stack_mixer }, |
| 4898 | .init_verbs = { alc880_volume_init_verbs, |
| 4899 | alc880_pin_clevo_init_verbs }, |
| 4900 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4901 | .dac_nids = alc880_dac_nids, |
| 4902 | .hp_nid = 0x03, |
| 4903 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4904 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4905 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4906 | .input_mux = &alc880_capture_source, |
| 4907 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4908 | [ALC880_LG] = { |
| 4909 | .mixers = { alc880_lg_mixer }, |
| 4910 | .init_verbs = { alc880_volume_init_verbs, |
| 4911 | alc880_lg_init_verbs }, |
| 4912 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4913 | .dac_nids = alc880_lg_dac_nids, |
| 4914 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4915 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4916 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4917 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4918 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4919 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4920 | .setup = alc880_lg_setup, |
| 4921 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4922 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4923 | .loopbacks = alc880_lg_loopbacks, |
| 4924 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4925 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4926 | [ALC880_LG_LW] = { |
| 4927 | .mixers = { alc880_lg_lw_mixer }, |
| 4928 | .init_verbs = { alc880_volume_init_verbs, |
| 4929 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4930 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4931 | .dac_nids = alc880_dac_nids, |
| 4932 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4933 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4934 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4935 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4936 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4937 | .setup = alc880_lg_lw_setup, |
| 4938 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4939 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4940 | [ALC880_MEDION_RIM] = { |
| 4941 | .mixers = { alc880_medion_rim_mixer }, |
| 4942 | .init_verbs = { alc880_volume_init_verbs, |
| 4943 | alc880_medion_rim_init_verbs, |
| 4944 | alc_gpio2_init_verbs }, |
| 4945 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4946 | .dac_nids = alc880_dac_nids, |
| 4947 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4948 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4949 | .channel_mode = alc880_2_jack_modes, |
| 4950 | .input_mux = &alc880_medion_rim_capture_source, |
| 4951 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4952 | .setup = alc880_medion_rim_setup, |
| 4953 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4954 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4955 | #ifdef CONFIG_SND_DEBUG |
| 4956 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4957 | .mixers = { alc880_test_mixer }, |
| 4958 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4959 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4960 | .dac_nids = alc880_test_dac_nids, |
| 4961 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4962 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4963 | .channel_mode = alc880_test_modes, |
| 4964 | .input_mux = &alc880_test_capture_source, |
| 4965 | }, |
| 4966 | #endif |
| 4967 | }; |
| 4968 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4969 | /* |
| 4970 | * Automatic parse of I/O pins from the BIOS configuration |
| 4971 | */ |
| 4972 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4973 | enum { |
| 4974 | ALC_CTL_WIDGET_VOL, |
| 4975 | ALC_CTL_WIDGET_MUTE, |
| 4976 | ALC_CTL_BIND_MUTE, |
| 4977 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4978 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4979 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4980 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4981 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4982 | }; |
| 4983 | |
| 4984 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4985 | 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] | 4986 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4987 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4988 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4989 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4990 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4991 | knew = snd_array_new(&spec->kctls); |
| 4992 | if (!knew) |
| 4993 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4994 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4995 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4996 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4997 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4998 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4999 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5000 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5001 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5002 | return 0; |
| 5003 | } |
| 5004 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5005 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5006 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5007 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5008 | { |
| 5009 | char name[32]; |
| 5010 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5011 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5012 | } |
| 5013 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5014 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5015 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5016 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5017 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5018 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5019 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5020 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5021 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5022 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5023 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5024 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5025 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5026 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5027 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5028 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5029 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5030 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5031 | #define ALC880_PIN_CD_NID 0x1c |
| 5032 | |
| 5033 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5034 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5035 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5036 | { |
| 5037 | hda_nid_t nid; |
| 5038 | int assigned[4]; |
| 5039 | int i, j; |
| 5040 | |
| 5041 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5042 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5043 | |
| 5044 | /* check the pins hardwired to audio widget */ |
| 5045 | for (i = 0; i < cfg->line_outs; i++) { |
| 5046 | nid = cfg->line_out_pins[i]; |
| 5047 | if (alc880_is_fixed_pin(nid)) { |
| 5048 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5049 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5050 | assigned[idx] = 1; |
| 5051 | } |
| 5052 | } |
| 5053 | /* left pins can be connect to any 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 | continue; |
| 5058 | /* search for an empty channel */ |
| 5059 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5060 | if (!assigned[j]) { |
| 5061 | spec->multiout.dac_nids[i] = |
| 5062 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5063 | assigned[j] = 1; |
| 5064 | break; |
| 5065 | } |
| 5066 | } |
| 5067 | } |
| 5068 | spec->multiout.num_dacs = cfg->line_outs; |
| 5069 | return 0; |
| 5070 | } |
| 5071 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5072 | static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg, |
| 5073 | bool can_be_master) |
| 5074 | { |
| 5075 | if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
| 5076 | return "Master"; |
| 5077 | |
| 5078 | switch (cfg->line_out_type) { |
| 5079 | case AUTO_PIN_SPEAKER_OUT: |
| 5080 | return "Speaker"; |
| 5081 | case AUTO_PIN_HP_OUT: |
| 5082 | return "Headphone"; |
| 5083 | default: |
| 5084 | if (cfg->line_outs == 1) |
| 5085 | return "PCM"; |
| 5086 | break; |
| 5087 | } |
| 5088 | return NULL; |
| 5089 | } |
| 5090 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5091 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5092 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5093 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5094 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5095 | static const char *chname[4] = { |
| 5096 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5097 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5098 | const char *pfx = alc_get_line_out_pfx(cfg, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5099 | hda_nid_t nid; |
| 5100 | int i, err; |
| 5101 | |
| 5102 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5103 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5104 | continue; |
| 5105 | 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] | 5106 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5107 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5108 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5109 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5110 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5111 | HDA_OUTPUT)); |
| 5112 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5113 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5114 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5115 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5116 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5117 | HDA_OUTPUT)); |
| 5118 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5119 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5120 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5121 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5122 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5123 | HDA_INPUT)); |
| 5124 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5125 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5126 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5127 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5128 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5129 | HDA_INPUT)); |
| 5130 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5131 | return err; |
| 5132 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5133 | const char *name = pfx; |
| 5134 | if (!name) |
| 5135 | name = chname[i]; |
| 5136 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5137 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5138 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5139 | HDA_OUTPUT)); |
| 5140 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5141 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5142 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5143 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5144 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5145 | HDA_INPUT)); |
| 5146 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5147 | return err; |
| 5148 | } |
| 5149 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5150 | return 0; |
| 5151 | } |
| 5152 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5153 | /* add playback controls for speaker and HP outputs */ |
| 5154 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5155 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5156 | { |
| 5157 | hda_nid_t nid; |
| 5158 | int err; |
| 5159 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5160 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5161 | return 0; |
| 5162 | |
| 5163 | if (alc880_is_fixed_pin(pin)) { |
| 5164 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5165 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5166 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5167 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5168 | else |
| 5169 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5170 | /* control HP volume/switch on the output mixer amp */ |
| 5171 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5172 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5173 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5174 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5175 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5176 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5177 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5178 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5179 | return err; |
| 5180 | } else if (alc880_is_multi_pin(pin)) { |
| 5181 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5182 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5183 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5184 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5185 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5186 | return err; |
| 5187 | } |
| 5188 | return 0; |
| 5189 | } |
| 5190 | |
| 5191 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5192 | 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] | 5193 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5194 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5195 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5196 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5197 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5198 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5199 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5200 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5201 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5202 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5203 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5204 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5205 | return err; |
| 5206 | return 0; |
| 5207 | } |
| 5208 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5209 | 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] | 5210 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5211 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5212 | return (pincap & AC_PINCAP_IN) != 0; |
| 5213 | } |
| 5214 | |
| 5215 | /* create playback/capture controls for input pins */ |
| 5216 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5217 | const struct auto_pin_cfg *cfg, |
| 5218 | hda_nid_t mixer, |
| 5219 | hda_nid_t cap1, hda_nid_t cap2) |
| 5220 | { |
| 5221 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5222 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5223 | int i, err, idx, type_idx = 0; |
| 5224 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5225 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5226 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5227 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5228 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5229 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5230 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5231 | if (!alc_is_input_pin(codec, pin)) |
| 5232 | continue; |
| 5233 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5234 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5235 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5236 | type_idx++; |
| 5237 | else |
| 5238 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5239 | prev_label = label; |
| 5240 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5241 | if (mixer) { |
| 5242 | idx = get_connection_index(codec, mixer, pin); |
| 5243 | if (idx >= 0) { |
| 5244 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5245 | label, type_idx, |
| 5246 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5247 | if (err < 0) |
| 5248 | return err; |
| 5249 | } |
| 5250 | } |
| 5251 | |
| 5252 | if (!cap1) |
| 5253 | continue; |
| 5254 | idx = get_connection_index(codec, cap1, pin); |
| 5255 | if (idx < 0 && cap2) |
| 5256 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5257 | if (idx >= 0) |
| 5258 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5259 | } |
| 5260 | return 0; |
| 5261 | } |
| 5262 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5263 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5264 | const struct auto_pin_cfg *cfg) |
| 5265 | { |
| 5266 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5267 | } |
| 5268 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5269 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5270 | unsigned int pin_type) |
| 5271 | { |
| 5272 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5273 | pin_type); |
| 5274 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5275 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5276 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5277 | } |
| 5278 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5279 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5280 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5281 | int dac_idx) |
| 5282 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5283 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5284 | /* need the manual connection? */ |
| 5285 | if (alc880_is_multi_pin(nid)) { |
| 5286 | struct alc_spec *spec = codec->spec; |
| 5287 | int idx = alc880_multi_pin_idx(nid); |
| 5288 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5289 | AC_VERB_SET_CONNECT_SEL, |
| 5290 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5291 | } |
| 5292 | } |
| 5293 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5294 | static int get_pin_type(int line_out_type) |
| 5295 | { |
| 5296 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5297 | return PIN_HP; |
| 5298 | else |
| 5299 | return PIN_OUT; |
| 5300 | } |
| 5301 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5302 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5303 | { |
| 5304 | struct alc_spec *spec = codec->spec; |
| 5305 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5306 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5307 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5308 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5309 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5310 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5311 | } |
| 5312 | } |
| 5313 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5314 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5315 | { |
| 5316 | struct alc_spec *spec = codec->spec; |
| 5317 | hda_nid_t pin; |
| 5318 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5319 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5320 | if (pin) /* connect to front */ |
| 5321 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5322 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5323 | if (pin) /* connect to front */ |
| 5324 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5325 | } |
| 5326 | |
| 5327 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5328 | { |
| 5329 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5330 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5331 | int i; |
| 5332 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5333 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5334 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5335 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5336 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5337 | if (nid != ALC880_PIN_CD_NID && |
| 5338 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5339 | snd_hda_codec_write(codec, nid, 0, |
| 5340 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5341 | AMP_OUT_MUTE); |
| 5342 | } |
| 5343 | } |
| 5344 | } |
| 5345 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5346 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5347 | { |
| 5348 | struct alc_spec *spec = codec->spec; |
| 5349 | int c; |
| 5350 | |
| 5351 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5352 | unsigned int mux_idx; |
| 5353 | const struct hda_input_mux *imux; |
| 5354 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5355 | imux = &spec->input_mux[mux_idx]; |
| 5356 | if (!imux->num_items && mux_idx > 0) |
| 5357 | imux = &spec->input_mux[0]; |
| 5358 | if (imux) |
| 5359 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5360 | AC_VERB_SET_CONNECT_SEL, |
| 5361 | imux->items[0].index); |
| 5362 | } |
| 5363 | } |
| 5364 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5365 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5366 | /* return 1 if successful, 0 if the proper config is not found, |
| 5367 | * or a negative error code |
| 5368 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5369 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5370 | { |
| 5371 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5372 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5373 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5374 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5375 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5376 | alc880_ignore); |
| 5377 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5378 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5379 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5380 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5381 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5382 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5383 | if (err < 0) |
| 5384 | return err; |
| 5385 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5386 | if (err < 0) |
| 5387 | return err; |
| 5388 | err = alc880_auto_create_extra_out(spec, |
| 5389 | spec->autocfg.speaker_pins[0], |
| 5390 | "Speaker"); |
| 5391 | if (err < 0) |
| 5392 | return err; |
| 5393 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5394 | "Headphone"); |
| 5395 | if (err < 0) |
| 5396 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5397 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5398 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5399 | return err; |
| 5400 | |
| 5401 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5402 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5403 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5404 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5405 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5406 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5407 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5408 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5409 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5410 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5411 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5412 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5413 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5414 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5415 | return 1; |
| 5416 | } |
| 5417 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5418 | /* additional initialization for auto-configuration model */ |
| 5419 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5420 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5421 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5422 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5423 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5424 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5425 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5426 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5427 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5428 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5429 | } |
| 5430 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5431 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5432 | * one of two digital mic pins, e.g. on ALC272 |
| 5433 | */ |
| 5434 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5435 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5436 | struct alc_spec *spec = codec->spec; |
| 5437 | int i; |
| 5438 | |
| 5439 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5440 | hda_nid_t cap = spec->capsrc_nids ? |
| 5441 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5442 | int iidx, eidx; |
| 5443 | |
| 5444 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5445 | if (iidx < 0) |
| 5446 | continue; |
| 5447 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5448 | if (eidx < 0) |
| 5449 | continue; |
| 5450 | spec->int_mic.mux_idx = iidx; |
| 5451 | spec->ext_mic.mux_idx = eidx; |
| 5452 | if (spec->capsrc_nids) |
| 5453 | spec->capsrc_nids += i; |
| 5454 | spec->adc_nids += i; |
| 5455 | spec->num_adc_nids = 1; |
| 5456 | return; |
| 5457 | } |
| 5458 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5459 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5460 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5461 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5462 | } |
| 5463 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5464 | /* select or unmute the given capsrc route */ |
| 5465 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5466 | int idx) |
| 5467 | { |
| 5468 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5469 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5470 | HDA_AMP_MUTE, 0); |
| 5471 | } else { |
| 5472 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5473 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5474 | } |
| 5475 | } |
| 5476 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5477 | /* set the default connection to that pin */ |
| 5478 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5479 | { |
| 5480 | struct alc_spec *spec = codec->spec; |
| 5481 | int i; |
| 5482 | |
| 5483 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5484 | hda_nid_t cap = spec->capsrc_nids ? |
| 5485 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5486 | int idx; |
| 5487 | |
| 5488 | idx = get_connection_index(codec, cap, pin); |
| 5489 | if (idx < 0) |
| 5490 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5491 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5492 | return i; /* return the found index */ |
| 5493 | } |
| 5494 | return -1; /* not found */ |
| 5495 | } |
| 5496 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5497 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5498 | static void fixup_single_adc(struct hda_codec *codec) |
| 5499 | { |
| 5500 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5501 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5502 | int i; |
| 5503 | |
| 5504 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5505 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5506 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5507 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5508 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5509 | /* use only this ADC */ |
| 5510 | if (spec->capsrc_nids) |
| 5511 | spec->capsrc_nids += i; |
| 5512 | spec->adc_nids += i; |
| 5513 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5514 | } |
| 5515 | } |
| 5516 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5517 | /* initialize dual adcs */ |
| 5518 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5519 | { |
| 5520 | struct alc_spec *spec = codec->spec; |
| 5521 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5522 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5523 | } |
| 5524 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5525 | static void set_capture_mixer(struct hda_codec *codec) |
| 5526 | { |
| 5527 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5528 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5529 | { alc_capture_mixer_nosrc1, |
| 5530 | alc_capture_mixer_nosrc2, |
| 5531 | alc_capture_mixer_nosrc3 }, |
| 5532 | { alc_capture_mixer1, |
| 5533 | alc_capture_mixer2, |
| 5534 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5535 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5536 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5537 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5538 | int num_adcs = spec->num_adc_nids; |
| 5539 | if (spec->dual_adc_switch) |
| 5540 | fixup_dual_adc_switch(codec); |
| 5541 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5542 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5543 | else if (spec->input_mux) { |
| 5544 | if (spec->input_mux->num_items > 1) |
| 5545 | mux = 1; |
| 5546 | else if (spec->input_mux->num_items == 1) |
| 5547 | fixup_single_adc(codec); |
| 5548 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5549 | if (spec->dual_adc_switch) |
| 5550 | num_adcs = 1; |
| 5551 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5552 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5553 | } |
| 5554 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5555 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5556 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5557 | int num_nids) |
| 5558 | { |
| 5559 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5560 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5561 | int n; |
| 5562 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5563 | |
| 5564 | for (n = 0; n < num_nids; n++) { |
| 5565 | hda_nid_t adc, cap; |
| 5566 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5567 | int nconns, i, j; |
| 5568 | |
| 5569 | adc = nids[n]; |
| 5570 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5571 | continue; |
| 5572 | cap = adc; |
| 5573 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5574 | ARRAY_SIZE(conn)); |
| 5575 | if (nconns == 1) { |
| 5576 | cap = conn[0]; |
| 5577 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5578 | ARRAY_SIZE(conn)); |
| 5579 | } |
| 5580 | if (nconns <= 0) |
| 5581 | continue; |
| 5582 | if (!fallback_adc) { |
| 5583 | fallback_adc = adc; |
| 5584 | fallback_cap = cap; |
| 5585 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5586 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5587 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5588 | for (j = 0; j < nconns; j++) { |
| 5589 | if (conn[j] == nid) |
| 5590 | break; |
| 5591 | } |
| 5592 | if (j >= nconns) |
| 5593 | break; |
| 5594 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5595 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5596 | int num_adcs = spec->num_adc_nids; |
| 5597 | spec->private_adc_nids[num_adcs] = adc; |
| 5598 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5599 | spec->num_adc_nids++; |
| 5600 | spec->adc_nids = spec->private_adc_nids; |
| 5601 | if (adc != cap) |
| 5602 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5603 | } |
| 5604 | } |
| 5605 | if (!spec->num_adc_nids) { |
| 5606 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5607 | " using fallback 0x%x\n", |
| 5608 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5609 | spec->private_adc_nids[0] = fallback_adc; |
| 5610 | spec->adc_nids = spec->private_adc_nids; |
| 5611 | if (fallback_adc != fallback_cap) { |
| 5612 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5613 | spec->capsrc_nids = spec->private_adc_nids; |
| 5614 | } |
| 5615 | } |
| 5616 | } |
| 5617 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5618 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5619 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5620 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5621 | |
| 5622 | static struct snd_pci_quirk beep_white_list[] = { |
| 5623 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5624 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5625 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5626 | {} |
| 5627 | }; |
| 5628 | |
| 5629 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5630 | { |
| 5631 | struct alc_spec *spec = codec->spec; |
| 5632 | const struct snd_pci_quirk *q; |
| 5633 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5634 | if (q) |
| 5635 | return q->value; |
| 5636 | return spec->cdefine.enable_pcbeep; |
| 5637 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5638 | #else |
| 5639 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5640 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5641 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5642 | |
| 5643 | /* |
| 5644 | * OK, here we have finally the patch for ALC880 |
| 5645 | */ |
| 5646 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5647 | static int patch_alc880(struct hda_codec *codec) |
| 5648 | { |
| 5649 | struct alc_spec *spec; |
| 5650 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5651 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5652 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5653 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5654 | if (spec == NULL) |
| 5655 | return -ENOMEM; |
| 5656 | |
| 5657 | codec->spec = spec; |
| 5658 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5659 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5660 | alc880_models, |
| 5661 | alc880_cfg_tbl); |
| 5662 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5663 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5664 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5665 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5666 | } |
| 5667 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5668 | if (board_config == ALC880_AUTO) { |
| 5669 | /* automatic parse from the BIOS config */ |
| 5670 | err = alc880_parse_auto_config(codec); |
| 5671 | if (err < 0) { |
| 5672 | alc_free(codec); |
| 5673 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5674 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5675 | printk(KERN_INFO |
| 5676 | "hda_codec: Cannot set up configuration " |
| 5677 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5678 | board_config = ALC880_3ST; |
| 5679 | } |
| 5680 | } |
| 5681 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5682 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5683 | if (err < 0) { |
| 5684 | alc_free(codec); |
| 5685 | return err; |
| 5686 | } |
| 5687 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5688 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5689 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5690 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5691 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5692 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5693 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5694 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5695 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5696 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5697 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5698 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5699 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5700 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5701 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5702 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5703 | if (wcap != AC_WID_AUD_IN) { |
| 5704 | spec->adc_nids = alc880_adc_nids_alt; |
| 5705 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5706 | } else { |
| 5707 | spec->adc_nids = alc880_adc_nids; |
| 5708 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5709 | } |
| 5710 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5711 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5712 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5713 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5714 | spec->vmaster_nid = 0x0c; |
| 5715 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5716 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5717 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5718 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5719 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5720 | if (!spec->loopback.amplist) |
| 5721 | spec->loopback.amplist = alc880_loopbacks; |
| 5722 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5723 | |
| 5724 | return 0; |
| 5725 | } |
| 5726 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5727 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5728 | /* |
| 5729 | * ALC260 support |
| 5730 | */ |
| 5731 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5732 | static hda_nid_t alc260_dac_nids[1] = { |
| 5733 | /* front */ |
| 5734 | 0x02, |
| 5735 | }; |
| 5736 | |
| 5737 | static hda_nid_t alc260_adc_nids[1] = { |
| 5738 | /* ADC0 */ |
| 5739 | 0x04, |
| 5740 | }; |
| 5741 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5742 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5743 | /* ADC1 */ |
| 5744 | 0x05, |
| 5745 | }; |
| 5746 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5747 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5748 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5749 | */ |
| 5750 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5751 | /* ADC0, ADC1 */ |
| 5752 | 0x04, 0x05 |
| 5753 | }; |
| 5754 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5755 | #define ALC260_DIGOUT_NID 0x03 |
| 5756 | #define ALC260_DIGIN_NID 0x06 |
| 5757 | |
| 5758 | static struct hda_input_mux alc260_capture_source = { |
| 5759 | .num_items = 4, |
| 5760 | .items = { |
| 5761 | { "Mic", 0x0 }, |
| 5762 | { "Front Mic", 0x1 }, |
| 5763 | { "Line", 0x2 }, |
| 5764 | { "CD", 0x4 }, |
| 5765 | }, |
| 5766 | }; |
| 5767 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5768 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5769 | * headphone jack and the internal CD lines since these are the only pins at |
| 5770 | * which audio can appear. For flexibility, also allow the option of |
| 5771 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5772 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5773 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5774 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5775 | { |
| 5776 | .num_items = 3, |
| 5777 | .items = { |
| 5778 | { "Mic/Line", 0x0 }, |
| 5779 | { "CD", 0x4 }, |
| 5780 | { "Headphone", 0x2 }, |
| 5781 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5782 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5783 | { |
| 5784 | .num_items = 4, |
| 5785 | .items = { |
| 5786 | { "Mic/Line", 0x0 }, |
| 5787 | { "CD", 0x4 }, |
| 5788 | { "Headphone", 0x2 }, |
| 5789 | { "Mixer", 0x5 }, |
| 5790 | }, |
| 5791 | }, |
| 5792 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5793 | }; |
| 5794 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5795 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5796 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5797 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5798 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5799 | { |
| 5800 | .num_items = 4, |
| 5801 | .items = { |
| 5802 | { "Mic", 0x0 }, |
| 5803 | { "Line", 0x2 }, |
| 5804 | { "CD", 0x4 }, |
| 5805 | { "Headphone", 0x5 }, |
| 5806 | }, |
| 5807 | }, |
| 5808 | { |
| 5809 | .num_items = 5, |
| 5810 | .items = { |
| 5811 | { "Mic", 0x0 }, |
| 5812 | { "Line", 0x2 }, |
| 5813 | { "CD", 0x4 }, |
| 5814 | { "Headphone", 0x6 }, |
| 5815 | { "Mixer", 0x5 }, |
| 5816 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5817 | }, |
| 5818 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5819 | |
| 5820 | /* Maxdata Favorit 100XS */ |
| 5821 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5822 | { |
| 5823 | .num_items = 2, |
| 5824 | .items = { |
| 5825 | { "Line/Mic", 0x0 }, |
| 5826 | { "CD", 0x4 }, |
| 5827 | }, |
| 5828 | }, |
| 5829 | { |
| 5830 | .num_items = 3, |
| 5831 | .items = { |
| 5832 | { "Line/Mic", 0x0 }, |
| 5833 | { "CD", 0x4 }, |
| 5834 | { "Mixer", 0x5 }, |
| 5835 | }, |
| 5836 | }, |
| 5837 | }; |
| 5838 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5839 | /* |
| 5840 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5841 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5842 | * element which allows changing the channel mode, so the verb list is |
| 5843 | * never used. |
| 5844 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5845 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5846 | { 2, NULL }, |
| 5847 | }; |
| 5848 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5849 | |
| 5850 | /* Mixer combinations |
| 5851 | * |
| 5852 | * basic: base_output + input + pc_beep + capture |
| 5853 | * HP: base_output + input + capture_alt |
| 5854 | * HP_3013: hp_3013 + input + capture |
| 5855 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5856 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5857 | */ |
| 5858 | |
| 5859 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5861 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5862 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5863 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5864 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5865 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5866 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5867 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5868 | |
| 5869 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5870 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5871 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5872 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5873 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5874 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5875 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5876 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5877 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5878 | { } /* end */ |
| 5879 | }; |
| 5880 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5881 | /* update HP, line and mono out pins according to the master switch */ |
| 5882 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5883 | hda_nid_t hp, hda_nid_t line, |
| 5884 | hda_nid_t mono) |
| 5885 | { |
| 5886 | struct alc_spec *spec = codec->spec; |
| 5887 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5888 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5889 | 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] | 5890 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5891 | 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] | 5892 | val); |
| 5893 | /* mono (speaker) depending on the HP jack sense */ |
| 5894 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5895 | 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] | 5896 | val); |
| 5897 | } |
| 5898 | |
| 5899 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5900 | struct snd_ctl_elem_value *ucontrol) |
| 5901 | { |
| 5902 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5903 | struct alc_spec *spec = codec->spec; |
| 5904 | *ucontrol->value.integer.value = spec->master_sw; |
| 5905 | return 0; |
| 5906 | } |
| 5907 | |
| 5908 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5909 | struct snd_ctl_elem_value *ucontrol) |
| 5910 | { |
| 5911 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5912 | struct alc_spec *spec = codec->spec; |
| 5913 | int val = !!*ucontrol->value.integer.value; |
| 5914 | hda_nid_t hp, line, mono; |
| 5915 | |
| 5916 | if (val == spec->master_sw) |
| 5917 | return 0; |
| 5918 | spec->master_sw = val; |
| 5919 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5920 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5921 | mono = kcontrol->private_value & 0xff; |
| 5922 | alc260_hp_master_update(codec, hp, line, mono); |
| 5923 | return 1; |
| 5924 | } |
| 5925 | |
| 5926 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5927 | { |
| 5928 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5929 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5930 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5931 | .info = snd_ctl_boolean_mono_info, |
| 5932 | .get = alc260_hp_master_sw_get, |
| 5933 | .put = alc260_hp_master_sw_put, |
| 5934 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5935 | }, |
| 5936 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5937 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5938 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5939 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5940 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5941 | HDA_OUTPUT), |
| 5942 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5943 | { } /* end */ |
| 5944 | }; |
| 5945 | |
| 5946 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5947 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5948 | {}, |
| 5949 | }; |
| 5950 | |
| 5951 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5952 | { |
| 5953 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5954 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5955 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5956 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5957 | } |
| 5958 | |
| 5959 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5960 | { |
| 5961 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5962 | alc260_hp_automute(codec); |
| 5963 | } |
| 5964 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5965 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5966 | { |
| 5967 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5968 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5969 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5970 | .info = snd_ctl_boolean_mono_info, |
| 5971 | .get = alc260_hp_master_sw_get, |
| 5972 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5973 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5974 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5975 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5976 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5977 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5978 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5979 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5980 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5981 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5982 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5983 | { } /* end */ |
| 5984 | }; |
| 5985 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5986 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5987 | .ops = &snd_hda_bind_vol, |
| 5988 | .values = { |
| 5989 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5990 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5991 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5992 | 0 |
| 5993 | }, |
| 5994 | }; |
| 5995 | |
| 5996 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5997 | .ops = &snd_hda_bind_sw, |
| 5998 | .values = { |
| 5999 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6000 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6001 | 0 |
| 6002 | }, |
| 6003 | }; |
| 6004 | |
| 6005 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 6006 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6007 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6008 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6010 | { } /* end */ |
| 6011 | }; |
| 6012 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6013 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 6014 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6015 | {}, |
| 6016 | }; |
| 6017 | |
| 6018 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 6019 | { |
| 6020 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6021 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6022 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6023 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6024 | } |
| 6025 | |
| 6026 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 6027 | unsigned int res) |
| 6028 | { |
| 6029 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6030 | alc260_hp_3013_automute(codec); |
| 6031 | } |
| 6032 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6033 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 6034 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6035 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6036 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6037 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6038 | bits); |
| 6039 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6040 | bits); |
| 6041 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6042 | bits); |
| 6043 | } |
| 6044 | |
| 6045 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 6046 | unsigned int res) |
| 6047 | { |
| 6048 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6049 | alc260_hp_3012_automute(codec); |
| 6050 | } |
| 6051 | |
| 6052 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6053 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6054 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6055 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6056 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6057 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6058 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6059 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6060 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6061 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6062 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6063 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6064 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6065 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6066 | { } /* end */ |
| 6067 | }; |
| 6068 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6069 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6070 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6071 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6072 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6073 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6074 | * revisions available in early 2006. Therefore for now allow the |
| 6075 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6076 | * that the lack of mic bias for this NID is intentional we could change the |
| 6077 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6078 | * |
| 6079 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6080 | * don't appear to make the mic bias available from the "line" jack, even |
| 6081 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6082 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6083 | * and the output jack. If this turns out to be the case for all such |
| 6084 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6085 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6086 | * |
| 6087 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6088 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6089 | * controls for such models. On models without a "mono speaker" the control |
| 6090 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6091 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6092 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6093 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6094 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6095 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6096 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6097 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6098 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6099 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6100 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6101 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6102 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6103 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6104 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6105 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6106 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6107 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6108 | { } /* end */ |
| 6109 | }; |
| 6110 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6111 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6112 | */ |
| 6113 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6114 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6115 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6116 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6117 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6118 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6119 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6120 | { } /* end */ |
| 6121 | }; |
| 6122 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6123 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6124 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6125 | */ |
| 6126 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6127 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6128 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6131 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6132 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6133 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6134 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6135 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6136 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6137 | { } /* end */ |
| 6138 | }; |
| 6139 | |
| 6140 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6141 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6142 | */ |
| 6143 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6144 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6145 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6146 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6147 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6148 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6149 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6150 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6151 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6152 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6153 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6154 | { } /* end */ |
| 6155 | }; |
| 6156 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6157 | /* |
| 6158 | * initialization verbs |
| 6159 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6160 | static struct hda_verb alc260_init_verbs[] = { |
| 6161 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6162 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6163 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6164 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6165 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6166 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6167 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6168 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6169 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6170 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6171 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6172 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6173 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6174 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6175 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6176 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6177 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6178 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6179 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6180 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6181 | /* set connection select to line in (default select for this ADC) */ |
| 6182 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6183 | /* mute capture amp left and right */ |
| 6184 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6185 | /* set connection select to line in (default select for this ADC) */ |
| 6186 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6187 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6188 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6189 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6190 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6191 | /* set vol=0 HP mixer amp left and right */ |
| 6192 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6193 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6194 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6195 | /* set vol=0 Mono mixer amp left and right */ |
| 6196 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6197 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6198 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6199 | /* unmute LINE-2 out pin */ |
| 6200 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6201 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6202 | * Line In 2 = 0x03 |
| 6203 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6204 | /* mute analog inputs */ |
| 6205 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6206 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6207 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6208 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6209 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6210 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6211 | /* mute Front out path */ |
| 6212 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6213 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6214 | /* mute Headphone out path */ |
| 6215 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6216 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6217 | /* mute Mono out path */ |
| 6218 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6219 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6220 | { } |
| 6221 | }; |
| 6222 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6223 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6224 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6225 | /* Headphone and output */ |
| 6226 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6227 | /* mono output */ |
| 6228 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6229 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6230 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6231 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6232 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6233 | /* Line In pin widget for input */ |
| 6234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6235 | /* Line-2 pin widget for output */ |
| 6236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6237 | /* CD pin widget for input */ |
| 6238 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6239 | /* unmute amp left and right */ |
| 6240 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6241 | /* set connection select to line in (default select for this ADC) */ |
| 6242 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6243 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6244 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6245 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6246 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6247 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6248 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6249 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6250 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6251 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6252 | * Line In 2 = 0x03 |
| 6253 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6254 | /* mute analog inputs */ |
| 6255 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6256 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6257 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6258 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6259 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6260 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6261 | /* Unmute Front out path */ |
| 6262 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6263 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6264 | /* Unmute Headphone out path */ |
| 6265 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6266 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6267 | /* Unmute Mono out path */ |
| 6268 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6269 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6270 | { } |
| 6271 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6272 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6273 | |
| 6274 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6275 | /* Line out and output */ |
| 6276 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6277 | /* mono output */ |
| 6278 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6279 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6280 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6281 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6282 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6283 | /* Line In pin widget for input */ |
| 6284 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6285 | /* Headphone pin widget for output */ |
| 6286 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6287 | /* CD pin widget for input */ |
| 6288 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6289 | /* unmute amp left and right */ |
| 6290 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6291 | /* set connection select to line in (default select for this ADC) */ |
| 6292 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6293 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6294 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6295 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6296 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6297 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6298 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6299 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6300 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6301 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6302 | * Line In 2 = 0x03 |
| 6303 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6304 | /* mute analog inputs */ |
| 6305 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6306 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6307 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6308 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6309 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6310 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6311 | /* Unmute Front out path */ |
| 6312 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6313 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6314 | /* Unmute Headphone out path */ |
| 6315 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6316 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6317 | /* Unmute Mono out path */ |
| 6318 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6319 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6320 | { } |
| 6321 | }; |
| 6322 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6323 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6324 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6325 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6326 | */ |
| 6327 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6328 | /* Disable all GPIOs */ |
| 6329 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6330 | /* Internal speaker is connected to headphone pin */ |
| 6331 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6332 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6333 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6334 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6335 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6336 | /* Ensure all other unused pins are disabled and muted. */ |
| 6337 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6338 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6339 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6340 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6341 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6342 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6343 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6344 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6345 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6346 | /* Disable digital (SPDIF) pins */ |
| 6347 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6348 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6349 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6350 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6351 | * when acting as an output. |
| 6352 | */ |
| 6353 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6354 | |
| 6355 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6356 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6357 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6358 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6359 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6360 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6361 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6362 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6363 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6364 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6365 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6366 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6367 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6368 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6369 | * If the pin mode is changed by the user the pin mode control will |
| 6370 | * take care of enabling the pin's input/output buffers as needed. |
| 6371 | * Therefore there's no need to enable the input buffer at this |
| 6372 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6373 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6374 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6375 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6376 | * mixer ctrl) |
| 6377 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6378 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6379 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6380 | /* Mute capture amp left and right */ |
| 6381 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6382 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6383 | * in (on mic1 pin) |
| 6384 | */ |
| 6385 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6386 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6387 | /* Do the same for the second ADC: mute capture input amp and |
| 6388 | * set ADC connection to line in (on mic1 pin) |
| 6389 | */ |
| 6390 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6391 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6392 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6393 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6394 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6395 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6396 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6399 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6400 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6401 | {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] | 6402 | |
| 6403 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6404 | }; |
| 6405 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6406 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6407 | * similar laptops (adapted from Fujitsu init verbs). |
| 6408 | */ |
| 6409 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6410 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6411 | * the headphone jack. Turn this on and rely on the standard mute |
| 6412 | * methods whenever the user wants to turn these outputs off. |
| 6413 | */ |
| 6414 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6415 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6416 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6417 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6418 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6419 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6420 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6421 | /* Line In jack is connected to Line1 pin */ |
| 6422 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6423 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6424 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6425 | /* Ensure all other unused pins are disabled and muted. */ |
| 6426 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6427 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6428 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6429 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6430 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6431 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6432 | /* Disable digital (SPDIF) pins */ |
| 6433 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6434 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6435 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6436 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6437 | * bus when acting as outputs. |
| 6438 | */ |
| 6439 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6440 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6441 | |
| 6442 | /* Start with output sum widgets muted and their output gains at min */ |
| 6443 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6444 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6445 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6446 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6447 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6448 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6449 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6450 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6451 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6452 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6453 | /* Unmute Line-out pin widget amp left and right |
| 6454 | * (no equiv mixer ctrl) |
| 6455 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6456 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6457 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6458 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6459 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6460 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6461 | * will take care of enabling the pin's input/output buffers as needed. |
| 6462 | * Therefore there's no need to enable the input buffer at this |
| 6463 | * stage. |
| 6464 | */ |
| 6465 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6466 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6467 | |
| 6468 | /* Mute capture amp left and right */ |
| 6469 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6470 | /* Set ADC connection select to match default mixer setting - mic |
| 6471 | * (on mic1 pin) |
| 6472 | */ |
| 6473 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6474 | |
| 6475 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6476 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6477 | */ |
| 6478 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6479 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6480 | |
| 6481 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6482 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6483 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6484 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6486 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6487 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6490 | |
| 6491 | { } |
| 6492 | }; |
| 6493 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6494 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6495 | * (adapted from Acer init verbs). |
| 6496 | */ |
| 6497 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6498 | /* GPIO 0 enables the output jack. |
| 6499 | * Turn this on and rely on the standard mute |
| 6500 | * methods whenever the user wants to turn these outputs off. |
| 6501 | */ |
| 6502 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6503 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6504 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6505 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6506 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6507 | /* Ensure all other unused pins are disabled and muted. */ |
| 6508 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6509 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6510 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6511 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6512 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6513 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6514 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6515 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6516 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6517 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6518 | /* Disable digital (SPDIF) pins */ |
| 6519 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6520 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6521 | |
| 6522 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6523 | * bus when acting as outputs. |
| 6524 | */ |
| 6525 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6526 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6527 | |
| 6528 | /* Start with output sum widgets muted and their output gains at min */ |
| 6529 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6530 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6531 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6532 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6533 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6534 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6535 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6536 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6537 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6538 | |
| 6539 | /* Unmute Line-out pin widget amp left and right |
| 6540 | * (no equiv mixer ctrl) |
| 6541 | */ |
| 6542 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6543 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6544 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6545 | * will take care of enabling the pin's input/output buffers as needed. |
| 6546 | * Therefore there's no need to enable the input buffer at this |
| 6547 | * stage. |
| 6548 | */ |
| 6549 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6550 | |
| 6551 | /* Mute capture amp left and right */ |
| 6552 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6553 | /* Set ADC connection select to match default mixer setting - mic |
| 6554 | * (on mic1 pin) |
| 6555 | */ |
| 6556 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6557 | |
| 6558 | /* Do similar with the second ADC: mute capture input amp and |
| 6559 | * set ADC connection to mic to match ALSA's default state. |
| 6560 | */ |
| 6561 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6562 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6563 | |
| 6564 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6565 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6566 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6567 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6568 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6569 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6570 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6571 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6572 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6573 | |
| 6574 | { } |
| 6575 | }; |
| 6576 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6577 | static struct hda_verb alc260_will_verbs[] = { |
| 6578 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6579 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6580 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6581 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6582 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6583 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6584 | {} |
| 6585 | }; |
| 6586 | |
| 6587 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6588 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6589 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6590 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6591 | |
| 6592 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6593 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6594 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6595 | |
| 6596 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6597 | {} |
| 6598 | }; |
| 6599 | |
| 6600 | /* toggle speaker-output according to the hp-jack state */ |
| 6601 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6602 | { |
| 6603 | unsigned int present; |
| 6604 | |
| 6605 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6606 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6607 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6608 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6609 | AC_VERB_SET_GPIO_DATA, 1); |
| 6610 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6611 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6612 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6613 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6614 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6615 | AC_VERB_SET_GPIO_DATA, 0); |
| 6616 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6617 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6618 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6619 | } |
| 6620 | } |
| 6621 | |
| 6622 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6623 | unsigned int res) |
| 6624 | { |
| 6625 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6626 | alc260_replacer_672v_automute(codec); |
| 6627 | } |
| 6628 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6629 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6630 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6631 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6632 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6633 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6634 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6635 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6636 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6637 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6638 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6639 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6640 | {} |
| 6641 | }; |
| 6642 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6643 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6644 | * configuration. |
| 6645 | */ |
| 6646 | #ifdef CONFIG_SND_DEBUG |
| 6647 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6648 | 0x02, |
| 6649 | }; |
| 6650 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6651 | 0x04, 0x05, |
| 6652 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6653 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6654 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6655 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6656 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6657 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6658 | { |
| 6659 | .num_items = 7, |
| 6660 | .items = { |
| 6661 | { "MIC1 pin", 0x0 }, |
| 6662 | { "MIC2 pin", 0x1 }, |
| 6663 | { "LINE1 pin", 0x2 }, |
| 6664 | { "LINE2 pin", 0x3 }, |
| 6665 | { "CD pin", 0x4 }, |
| 6666 | { "LINE-OUT pin", 0x5 }, |
| 6667 | { "HP-OUT pin", 0x6 }, |
| 6668 | }, |
| 6669 | }, |
| 6670 | { |
| 6671 | .num_items = 8, |
| 6672 | .items = { |
| 6673 | { "MIC1 pin", 0x0 }, |
| 6674 | { "MIC2 pin", 0x1 }, |
| 6675 | { "LINE1 pin", 0x2 }, |
| 6676 | { "LINE2 pin", 0x3 }, |
| 6677 | { "CD pin", 0x4 }, |
| 6678 | { "Mixer", 0x5 }, |
| 6679 | { "LINE-OUT pin", 0x6 }, |
| 6680 | { "HP-OUT pin", 0x7 }, |
| 6681 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6682 | }, |
| 6683 | }; |
| 6684 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6685 | /* Output driver widgets */ |
| 6686 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6687 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6688 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6689 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6690 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6691 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6692 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6693 | /* Modes for retasking pin widgets |
| 6694 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6695 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6696 | * mention this restriction. At this stage it's not clear whether |
| 6697 | * this behaviour is intentional or is a hardware bug in chip |
| 6698 | * revisions available at least up until early 2006. Therefore for |
| 6699 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6700 | * choices, but if it turns out that the lack of mic bias for these |
| 6701 | * NIDs is intentional we could change their modes from |
| 6702 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6703 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6704 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6705 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6706 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6707 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6708 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6709 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6710 | |
| 6711 | /* Loopback mixer controls */ |
| 6712 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6713 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6714 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6715 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6716 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6717 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6718 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6719 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6720 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6721 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6722 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6723 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6724 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6725 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6726 | |
| 6727 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6728 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6729 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6730 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6731 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6732 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6733 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6734 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6735 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6736 | */ |
| 6737 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6738 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6739 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6740 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6741 | * this output to turn on an external amplifier. |
| 6742 | */ |
| 6743 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6744 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6745 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6746 | { } /* end */ |
| 6747 | }; |
| 6748 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6749 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6750 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6751 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6752 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6753 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6754 | /* Enable retasking pins as output, initially without power amp */ |
| 6755 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6756 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6757 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6758 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6759 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6760 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6761 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6762 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6763 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6764 | * payload also sets the generation to 0, output to be in "consumer" |
| 6765 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6766 | * control. |
| 6767 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6768 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6769 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6770 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6771 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6772 | * OUT1 sum bus when acting as an output. |
| 6773 | */ |
| 6774 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6775 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6776 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6777 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6778 | |
| 6779 | /* Start with output sum widgets muted and their output gains at min */ |
| 6780 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6781 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6782 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6783 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6784 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6785 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6786 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6787 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6788 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6789 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6790 | /* Unmute retasking pin widget output buffers since the default |
| 6791 | * state appears to be output. As the pin mode is changed by the |
| 6792 | * user the pin mode control will take care of enabling the pin's |
| 6793 | * input/output buffers as needed. |
| 6794 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6795 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6796 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6797 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6798 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6799 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6800 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6801 | /* Also unmute the mono-out pin widget */ |
| 6802 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6803 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6804 | /* Mute capture amp left and right */ |
| 6805 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6806 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6807 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6808 | */ |
| 6809 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6810 | |
| 6811 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6812 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6813 | */ |
| 6814 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6815 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6816 | |
| 6817 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6818 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6819 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6820 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6821 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6822 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6823 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6824 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6825 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6826 | |
| 6827 | { } |
| 6828 | }; |
| 6829 | #endif |
| 6830 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6831 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6832 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6833 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6834 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6835 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6836 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6837 | /* |
| 6838 | * for BIOS auto-configuration |
| 6839 | */ |
| 6840 | |
| 6841 | 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] | 6842 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6843 | { |
| 6844 | hda_nid_t nid_vol; |
| 6845 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6846 | int err; |
| 6847 | |
| 6848 | if (nid >= 0x0f && nid < 0x11) { |
| 6849 | nid_vol = nid - 0x7; |
| 6850 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6851 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6852 | } else if (nid == 0x11) { |
| 6853 | nid_vol = nid - 0x7; |
| 6854 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6855 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6856 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6857 | nid_vol = 0x08; |
| 6858 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6859 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6860 | } else |
| 6861 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6862 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6863 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6864 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6865 | 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] | 6866 | if (err < 0) |
| 6867 | return err; |
| 6868 | *vol_bits |= (1 << nid_vol); |
| 6869 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6870 | 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] | 6871 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6872 | return err; |
| 6873 | return 1; |
| 6874 | } |
| 6875 | |
| 6876 | /* add playback controls from the parsed DAC table */ |
| 6877 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6878 | const struct auto_pin_cfg *cfg) |
| 6879 | { |
| 6880 | hda_nid_t nid; |
| 6881 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6882 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6883 | |
| 6884 | spec->multiout.num_dacs = 1; |
| 6885 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6886 | spec->multiout.dac_nids[0] = 0x02; |
| 6887 | |
| 6888 | nid = cfg->line_out_pins[0]; |
| 6889 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6890 | const char *pfx; |
| 6891 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6892 | pfx = "Master"; |
| 6893 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6894 | pfx = "Speaker"; |
| 6895 | else |
| 6896 | pfx = "Front"; |
| 6897 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6898 | if (err < 0) |
| 6899 | return err; |
| 6900 | } |
| 6901 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6902 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6903 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6904 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6905 | if (err < 0) |
| 6906 | return err; |
| 6907 | } |
| 6908 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6909 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6910 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6911 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6912 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6913 | if (err < 0) |
| 6914 | return err; |
| 6915 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6916 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6917 | } |
| 6918 | |
| 6919 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6920 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6921 | const struct auto_pin_cfg *cfg) |
| 6922 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6923 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6924 | } |
| 6925 | |
| 6926 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6927 | hda_nid_t nid, int pin_type, |
| 6928 | int sel_idx) |
| 6929 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6930 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6931 | /* need the manual connection? */ |
| 6932 | if (nid >= 0x12) { |
| 6933 | int idx = nid - 0x12; |
| 6934 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6935 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6936 | } |
| 6937 | } |
| 6938 | |
| 6939 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6940 | { |
| 6941 | struct alc_spec *spec = codec->spec; |
| 6942 | hda_nid_t nid; |
| 6943 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6944 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6945 | if (nid) { |
| 6946 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6947 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6948 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6949 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6950 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6951 | if (nid) |
| 6952 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6953 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6954 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6955 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6956 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6957 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6958 | |
| 6959 | #define ALC260_PIN_CD_NID 0x16 |
| 6960 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6961 | { |
| 6962 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6963 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6964 | int i; |
| 6965 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6966 | for (i = 0; i < cfg->num_inputs; i++) { |
| 6967 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6968 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 6969 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6970 | if (nid != ALC260_PIN_CD_NID && |
| 6971 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6972 | snd_hda_codec_write(codec, nid, 0, |
| 6973 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6974 | AMP_OUT_MUTE); |
| 6975 | } |
| 6976 | } |
| 6977 | } |
| 6978 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6979 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6980 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6981 | /* |
| 6982 | * generic initialization of ADC, input mixers and output mixers |
| 6983 | */ |
| 6984 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6985 | /* |
| 6986 | * Unmute ADC0-1 and set the default input to mic-in |
| 6987 | */ |
| 6988 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6989 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6990 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6991 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6992 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6993 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6994 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6995 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6996 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6997 | */ |
| 6998 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6999 | /* mute analog inputs */ |
| 7000 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7001 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7002 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7003 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7005 | |
| 7006 | /* |
| 7007 | * Set up output mixers (0x08 - 0x0a) |
| 7008 | */ |
| 7009 | /* set vol=0 to output mixers */ |
| 7010 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7011 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7012 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7013 | /* set up input amps for analog loopback */ |
| 7014 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7015 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7016 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7017 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7018 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7019 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7020 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7021 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7022 | { } |
| 7023 | }; |
| 7024 | |
| 7025 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7026 | { |
| 7027 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7028 | int err; |
| 7029 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7030 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7031 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7032 | alc260_ignore); |
| 7033 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7034 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7035 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7036 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7037 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7038 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7039 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7040 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7041 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7042 | return err; |
| 7043 | |
| 7044 | spec->multiout.max_channels = 2; |
| 7045 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7046 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7047 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7048 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7049 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7050 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7051 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7052 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7053 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7054 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7055 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7056 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7057 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7058 | return 1; |
| 7059 | } |
| 7060 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7061 | /* additional initialization for auto-configuration model */ |
| 7062 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7063 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7064 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7065 | alc260_auto_init_multi_out(codec); |
| 7066 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7067 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7068 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7069 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7070 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7071 | } |
| 7072 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7073 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7074 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7075 | { 0x07, HDA_INPUT, 0 }, |
| 7076 | { 0x07, HDA_INPUT, 1 }, |
| 7077 | { 0x07, HDA_INPUT, 2 }, |
| 7078 | { 0x07, HDA_INPUT, 3 }, |
| 7079 | { 0x07, HDA_INPUT, 4 }, |
| 7080 | { } /* end */ |
| 7081 | }; |
| 7082 | #endif |
| 7083 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7084 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7085 | * Pin config fixes |
| 7086 | */ |
| 7087 | enum { |
| 7088 | PINFIX_HP_DC5750, |
| 7089 | }; |
| 7090 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7091 | static const struct alc_fixup alc260_fixups[] = { |
| 7092 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7093 | .pins = (const struct alc_pincfg[]) { |
| 7094 | { 0x11, 0x90130110 }, /* speaker */ |
| 7095 | { } |
| 7096 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7097 | }, |
| 7098 | }; |
| 7099 | |
| 7100 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7101 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7102 | {} |
| 7103 | }; |
| 7104 | |
| 7105 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7106 | * ALC260 configurations |
| 7107 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7108 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 7109 | [ALC260_BASIC] = "basic", |
| 7110 | [ALC260_HP] = "hp", |
| 7111 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7112 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7113 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7114 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7115 | [ALC260_WILL] = "will", |
| 7116 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7117 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7118 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7119 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7120 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7121 | [ALC260_AUTO] = "auto", |
| 7122 | }; |
| 7123 | |
| 7124 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7125 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7126 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7127 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7128 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7129 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7130 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7131 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7132 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7133 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7134 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7135 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7136 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7137 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7138 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7139 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7140 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7141 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7142 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7143 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7144 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7145 | {} |
| 7146 | }; |
| 7147 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7148 | static struct alc_config_preset alc260_presets[] = { |
| 7149 | [ALC260_BASIC] = { |
| 7150 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7151 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7152 | .init_verbs = { alc260_init_verbs }, |
| 7153 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7154 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7155 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7156 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7157 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7158 | .channel_mode = alc260_modes, |
| 7159 | .input_mux = &alc260_capture_source, |
| 7160 | }, |
| 7161 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7162 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7163 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7164 | .init_verbs = { alc260_init_verbs, |
| 7165 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7166 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7167 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7168 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7169 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7170 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7171 | .channel_mode = alc260_modes, |
| 7172 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7173 | .unsol_event = alc260_hp_unsol_event, |
| 7174 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7175 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7176 | [ALC260_HP_DC7600] = { |
| 7177 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7178 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7179 | .init_verbs = { alc260_init_verbs, |
| 7180 | alc260_hp_dc7600_verbs }, |
| 7181 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7182 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7183 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7184 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7185 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7186 | .channel_mode = alc260_modes, |
| 7187 | .input_mux = &alc260_capture_source, |
| 7188 | .unsol_event = alc260_hp_3012_unsol_event, |
| 7189 | .init_hook = alc260_hp_3012_automute, |
| 7190 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7191 | [ALC260_HP_3013] = { |
| 7192 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7193 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7194 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7195 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7196 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7197 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7198 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7199 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7200 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7201 | .channel_mode = alc260_modes, |
| 7202 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7203 | .unsol_event = alc260_hp_3013_unsol_event, |
| 7204 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7205 | }, |
| 7206 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7207 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7208 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7209 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7210 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7211 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7212 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7213 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7214 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7215 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7216 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7217 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7218 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7219 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7220 | .init_verbs = { alc260_acer_init_verbs }, |
| 7221 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7222 | .dac_nids = alc260_dac_nids, |
| 7223 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7224 | .adc_nids = alc260_dual_adc_nids, |
| 7225 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7226 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7227 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7228 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7229 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7230 | [ALC260_FAVORIT100] = { |
| 7231 | .mixers = { alc260_favorit100_mixer }, |
| 7232 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7233 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7234 | .dac_nids = alc260_dac_nids, |
| 7235 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7236 | .adc_nids = alc260_dual_adc_nids, |
| 7237 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7238 | .channel_mode = alc260_modes, |
| 7239 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7240 | .input_mux = alc260_favorit100_capture_sources, |
| 7241 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7242 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7243 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7244 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7245 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7246 | .dac_nids = alc260_dac_nids, |
| 7247 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7248 | .adc_nids = alc260_adc_nids, |
| 7249 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7250 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7251 | .channel_mode = alc260_modes, |
| 7252 | .input_mux = &alc260_capture_source, |
| 7253 | }, |
| 7254 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7255 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7256 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7257 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7258 | .dac_nids = alc260_dac_nids, |
| 7259 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7260 | .adc_nids = alc260_adc_nids, |
| 7261 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7262 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7263 | .channel_mode = alc260_modes, |
| 7264 | .input_mux = &alc260_capture_source, |
| 7265 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7266 | .init_hook = alc260_replacer_672v_automute, |
| 7267 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7268 | #ifdef CONFIG_SND_DEBUG |
| 7269 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7270 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7271 | .init_verbs = { alc260_test_init_verbs }, |
| 7272 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7273 | .dac_nids = alc260_test_dac_nids, |
| 7274 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7275 | .adc_nids = alc260_test_adc_nids, |
| 7276 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7277 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7278 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7279 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7280 | }, |
| 7281 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7282 | }; |
| 7283 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7284 | static int patch_alc260(struct hda_codec *codec) |
| 7285 | { |
| 7286 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7287 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7288 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7289 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7290 | if (spec == NULL) |
| 7291 | return -ENOMEM; |
| 7292 | |
| 7293 | codec->spec = spec; |
| 7294 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7295 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7296 | alc260_models, |
| 7297 | alc260_cfg_tbl); |
| 7298 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7299 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7300 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7301 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7302 | } |
| 7303 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7304 | if (board_config == ALC260_AUTO) |
| 7305 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); |
| 7306 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7307 | if (board_config == ALC260_AUTO) { |
| 7308 | /* automatic parse from the BIOS config */ |
| 7309 | err = alc260_parse_auto_config(codec); |
| 7310 | if (err < 0) { |
| 7311 | alc_free(codec); |
| 7312 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7313 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7314 | printk(KERN_INFO |
| 7315 | "hda_codec: Cannot set up configuration " |
| 7316 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7317 | board_config = ALC260_BASIC; |
| 7318 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7319 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7320 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7321 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7322 | if (err < 0) { |
| 7323 | alc_free(codec); |
| 7324 | return err; |
| 7325 | } |
| 7326 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7327 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7328 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7329 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7330 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7331 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7332 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7333 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7334 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7335 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7336 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7337 | if (!spec->adc_nids && spec->input_mux) { |
| 7338 | /* check whether NID 0x04 is valid */ |
| 7339 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7340 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7341 | /* get type */ |
| 7342 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7343 | spec->adc_nids = alc260_adc_nids_alt; |
| 7344 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7345 | } else { |
| 7346 | spec->adc_nids = alc260_adc_nids; |
| 7347 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7348 | } |
| 7349 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7350 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7351 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7352 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7353 | if (board_config == ALC260_AUTO) |
| 7354 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); |
| 7355 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7356 | spec->vmaster_nid = 0x08; |
| 7357 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7358 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7359 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7360 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7361 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7362 | if (!spec->loopback.amplist) |
| 7363 | spec->loopback.amplist = alc260_loopbacks; |
| 7364 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7365 | |
| 7366 | return 0; |
| 7367 | } |
| 7368 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7369 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7370 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7371 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7372 | * |
| 7373 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7374 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7375 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7376 | * 6-channel independent captures. |
| 7377 | * |
| 7378 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7379 | * driver yet). |
| 7380 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7381 | #define ALC882_DIGOUT_NID 0x06 |
| 7382 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7383 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7384 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7385 | #define ALC1200_DIGOUT_NID 0x10 |
| 7386 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7387 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7388 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7389 | { 8, NULL } |
| 7390 | }; |
| 7391 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7392 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7393 | static hda_nid_t alc882_dac_nids[4] = { |
| 7394 | /* front, rear, clfe, rear_surr */ |
| 7395 | 0x02, 0x03, 0x04, 0x05 |
| 7396 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7397 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7398 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7399 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7400 | #define alc882_adc_nids alc880_adc_nids |
| 7401 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7402 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7403 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7404 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7405 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7406 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7407 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7408 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7409 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7410 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7411 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7412 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7413 | /* input MUX */ |
| 7414 | /* FIXME: should be a matrix-type input source selection */ |
| 7415 | |
| 7416 | static struct hda_input_mux alc882_capture_source = { |
| 7417 | .num_items = 4, |
| 7418 | .items = { |
| 7419 | { "Mic", 0x0 }, |
| 7420 | { "Front Mic", 0x1 }, |
| 7421 | { "Line", 0x2 }, |
| 7422 | { "CD", 0x4 }, |
| 7423 | }, |
| 7424 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7425 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7426 | #define alc883_capture_source alc882_capture_source |
| 7427 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7428 | static struct hda_input_mux alc889_capture_source = { |
| 7429 | .num_items = 3, |
| 7430 | .items = { |
| 7431 | { "Front Mic", 0x0 }, |
| 7432 | { "Mic", 0x3 }, |
| 7433 | { "Line", 0x2 }, |
| 7434 | }, |
| 7435 | }; |
| 7436 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7437 | static struct hda_input_mux mb5_capture_source = { |
| 7438 | .num_items = 3, |
| 7439 | .items = { |
| 7440 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7441 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7442 | { "CD", 0x4 }, |
| 7443 | }, |
| 7444 | }; |
| 7445 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7446 | static struct hda_input_mux macmini3_capture_source = { |
| 7447 | .num_items = 2, |
| 7448 | .items = { |
| 7449 | { "Line", 0x2 }, |
| 7450 | { "CD", 0x4 }, |
| 7451 | }, |
| 7452 | }; |
| 7453 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7454 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7455 | .num_items = 4, |
| 7456 | .items = { |
| 7457 | { "Mic", 0x1 }, |
| 7458 | { "Front Mic", 0x0 }, |
| 7459 | { "Line", 0x2 }, |
| 7460 | { "CD", 0x4 }, |
| 7461 | }, |
| 7462 | }; |
| 7463 | |
| 7464 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7465 | .num_items = 2, |
| 7466 | .items = { |
| 7467 | { "Mic", 0x1 }, |
| 7468 | { "Line", 0x2 }, |
| 7469 | }, |
| 7470 | }; |
| 7471 | |
| 7472 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7473 | .num_items = 4, |
| 7474 | .items = { |
| 7475 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7476 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7477 | { "Line", 0x2 }, |
| 7478 | { "CD", 0x4 }, |
| 7479 | }, |
| 7480 | }; |
| 7481 | |
| 7482 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7483 | .num_items = 2, |
| 7484 | .items = { |
| 7485 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7486 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7487 | }, |
| 7488 | }; |
| 7489 | |
| 7490 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7491 | .num_items = 3, |
| 7492 | .items = { |
| 7493 | { "Mic", 0x0 }, |
| 7494 | { "Front Mic", 0x1 }, |
| 7495 | { "Line", 0x4 }, |
| 7496 | }, |
| 7497 | }; |
| 7498 | |
| 7499 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7500 | .num_items = 2, |
| 7501 | .items = { |
| 7502 | { "Mic", 0x0 }, |
| 7503 | { "Line", 0x2 }, |
| 7504 | }, |
| 7505 | }; |
| 7506 | |
| 7507 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7508 | .num_items = 2, |
| 7509 | .items = { |
| 7510 | { "Mic", 0x0 }, |
| 7511 | /* Front Mic (0x01) unused */ |
| 7512 | { "Line", 0x2 }, |
| 7513 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7514 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7515 | }, |
| 7516 | }; |
| 7517 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7518 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7519 | .num_items = 2, |
| 7520 | .items = { |
| 7521 | { "Mic", 0x01 }, |
| 7522 | { "Line", 0x2 }, /* Not sure! */ |
| 7523 | }, |
| 7524 | }; |
| 7525 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7526 | /* |
| 7527 | * 2ch mode |
| 7528 | */ |
| 7529 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7530 | { 2, NULL } |
| 7531 | }; |
| 7532 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7533 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7534 | * 2ch mode |
| 7535 | */ |
| 7536 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7537 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7538 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7539 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7540 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7541 | { } /* end */ |
| 7542 | }; |
| 7543 | |
| 7544 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7545 | * 4ch mode |
| 7546 | */ |
| 7547 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7548 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7549 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7550 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7551 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7552 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7553 | { } /* end */ |
| 7554 | }; |
| 7555 | |
| 7556 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7557 | * 6ch mode |
| 7558 | */ |
| 7559 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7560 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7561 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7562 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7563 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7564 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7565 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7566 | { } /* end */ |
| 7567 | }; |
| 7568 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7569 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7570 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7571 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7572 | { 6, alc882_3ST_ch6_init }, |
| 7573 | }; |
| 7574 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7575 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7576 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7577 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7578 | * 2ch mode |
| 7579 | */ |
| 7580 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7581 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7582 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7583 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7584 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7585 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7586 | { } /* end */ |
| 7587 | }; |
| 7588 | |
| 7589 | /* |
| 7590 | * 4ch mode |
| 7591 | */ |
| 7592 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7593 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7594 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7595 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7596 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7597 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7598 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7599 | { } /* end */ |
| 7600 | }; |
| 7601 | |
| 7602 | /* |
| 7603 | * 6ch mode |
| 7604 | */ |
| 7605 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7606 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7607 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7608 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7609 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7610 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7611 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7612 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7613 | { } /* end */ |
| 7614 | }; |
| 7615 | |
| 7616 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7617 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7618 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7619 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7620 | }; |
| 7621 | |
| 7622 | |
| 7623 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7624 | * 6ch mode |
| 7625 | */ |
| 7626 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7627 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7628 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7629 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7630 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7631 | { } /* end */ |
| 7632 | }; |
| 7633 | |
| 7634 | /* |
| 7635 | * 8ch mode |
| 7636 | */ |
| 7637 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7638 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7639 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7640 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7641 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7642 | { } /* end */ |
| 7643 | }; |
| 7644 | |
| 7645 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7646 | { 6, alc882_sixstack_ch6_init }, |
| 7647 | { 8, alc882_sixstack_ch8_init }, |
| 7648 | }; |
| 7649 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7650 | |
| 7651 | /* Macbook Air 2,1 */ |
| 7652 | |
| 7653 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7654 | { 2, NULL }, |
| 7655 | }; |
| 7656 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7657 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7658 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7659 | */ |
| 7660 | |
| 7661 | /* |
| 7662 | * 2ch mode |
| 7663 | */ |
| 7664 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7665 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7666 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7667 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7668 | { } /* end */ |
| 7669 | }; |
| 7670 | |
| 7671 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7672 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7673 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7674 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7675 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7676 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7677 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7678 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7679 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7680 | { } /* end */ |
| 7681 | }; |
| 7682 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7683 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7684 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7685 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7686 | }; |
| 7687 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7688 | /* |
| 7689 | * 2ch |
| 7690 | * Speakers/Woofer/HP = Front |
| 7691 | * LineIn = Input |
| 7692 | */ |
| 7693 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7694 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7695 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7696 | { } /* end */ |
| 7697 | }; |
| 7698 | |
| 7699 | /* |
| 7700 | * 6ch mode |
| 7701 | * Speakers/HP = Front |
| 7702 | * Woofer = LFE |
| 7703 | * LineIn = Surround |
| 7704 | */ |
| 7705 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7706 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7707 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7708 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7709 | { } /* end */ |
| 7710 | }; |
| 7711 | |
| 7712 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7713 | { 2, alc885_mb5_ch2_init }, |
| 7714 | { 6, alc885_mb5_ch6_init }, |
| 7715 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7716 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7717 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7718 | |
| 7719 | /* |
| 7720 | * 2ch mode |
| 7721 | */ |
| 7722 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7723 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7724 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7725 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7726 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7727 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7728 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7729 | { } /* end */ |
| 7730 | }; |
| 7731 | |
| 7732 | /* |
| 7733 | * 4ch mode |
| 7734 | */ |
| 7735 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7736 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7737 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7738 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7739 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7740 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7741 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7742 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7743 | { } /* end */ |
| 7744 | }; |
| 7745 | |
| 7746 | /* |
| 7747 | * 6ch mode |
| 7748 | */ |
| 7749 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7750 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7751 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7752 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7753 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7754 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7755 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7756 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7757 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7758 | { } /* end */ |
| 7759 | }; |
| 7760 | |
| 7761 | /* |
| 7762 | * 8ch mode |
| 7763 | */ |
| 7764 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7765 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7766 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7767 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7768 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7769 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7770 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7771 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7772 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7773 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7774 | { } /* end */ |
| 7775 | }; |
| 7776 | |
| 7777 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7778 | { 2, alc883_4ST_ch2_init }, |
| 7779 | { 4, alc883_4ST_ch4_init }, |
| 7780 | { 6, alc883_4ST_ch6_init }, |
| 7781 | { 8, alc883_4ST_ch8_init }, |
| 7782 | }; |
| 7783 | |
| 7784 | |
| 7785 | /* |
| 7786 | * 2ch mode |
| 7787 | */ |
| 7788 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7789 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7790 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7791 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7792 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7793 | { } /* end */ |
| 7794 | }; |
| 7795 | |
| 7796 | /* |
| 7797 | * 4ch mode |
| 7798 | */ |
| 7799 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7800 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7801 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7802 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7803 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7804 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7805 | { } /* end */ |
| 7806 | }; |
| 7807 | |
| 7808 | /* |
| 7809 | * 6ch mode |
| 7810 | */ |
| 7811 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7812 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7813 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7814 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7815 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7816 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7817 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7818 | { } /* end */ |
| 7819 | }; |
| 7820 | |
| 7821 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7822 | { 2, alc883_3ST_ch2_intel_init }, |
| 7823 | { 4, alc883_3ST_ch4_intel_init }, |
| 7824 | { 6, alc883_3ST_ch6_intel_init }, |
| 7825 | }; |
| 7826 | |
| 7827 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7828 | * 2ch mode |
| 7829 | */ |
| 7830 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7831 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7832 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7833 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7834 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7835 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7836 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7837 | { } /* end */ |
| 7838 | }; |
| 7839 | |
| 7840 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7841 | * 6ch mode |
| 7842 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7843 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7844 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7845 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7846 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7847 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7848 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7849 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7850 | { } /* end */ |
| 7851 | }; |
| 7852 | |
| 7853 | /* |
| 7854 | * 8ch mode |
| 7855 | */ |
| 7856 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7857 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7858 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7859 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7860 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7861 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7862 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7863 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7864 | { } /* end */ |
| 7865 | }; |
| 7866 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7867 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7868 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7869 | { 6, alc889_ch6_intel_init }, |
| 7870 | { 8, alc889_ch8_intel_init }, |
| 7871 | }; |
| 7872 | |
| 7873 | /* |
| 7874 | * 6ch mode |
| 7875 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7876 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7877 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7878 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7879 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7880 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7881 | { } /* end */ |
| 7882 | }; |
| 7883 | |
| 7884 | /* |
| 7885 | * 8ch mode |
| 7886 | */ |
| 7887 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7888 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7889 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7890 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7891 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7892 | { } /* end */ |
| 7893 | }; |
| 7894 | |
| 7895 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7896 | { 6, alc883_sixstack_ch6_init }, |
| 7897 | { 8, alc883_sixstack_ch8_init }, |
| 7898 | }; |
| 7899 | |
| 7900 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7901 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7902 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7903 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7904 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7905 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7906 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7907 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7908 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7909 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7910 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7911 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7912 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7913 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7914 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7915 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7916 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7917 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7918 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7919 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7920 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7921 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7922 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7923 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7924 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7925 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7926 | { } /* end */ |
| 7927 | }; |
| 7928 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7929 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7930 | |
| 7931 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7932 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7933 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7934 | { } |
| 7935 | }; |
| 7936 | |
| 7937 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7938 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7939 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7940 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7941 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7942 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7943 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7944 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7945 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7946 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7947 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7948 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 7949 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7950 | { } /* end */ |
| 7951 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7952 | |
| 7953 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7954 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7955 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7956 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7957 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7958 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7959 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7960 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7961 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7962 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7963 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7964 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7965 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7966 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 7967 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7968 | { } /* end */ |
| 7969 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7970 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7971 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7972 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7973 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7974 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7975 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7976 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7977 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7978 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7979 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7980 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7981 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7982 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7983 | { } /* end */ |
| 7984 | }; |
| 7985 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7986 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7987 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7988 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7989 | { } /* end */ |
| 7990 | }; |
| 7991 | |
| 7992 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7993 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7994 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7995 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7996 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7997 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7999 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8001 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8003 | { } /* end */ |
| 8004 | }; |
| 8005 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8006 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 8007 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8008 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8010 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8011 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8012 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8013 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8014 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8015 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8016 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8017 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8018 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8019 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8020 | { } /* end */ |
| 8021 | }; |
| 8022 | |
| 8023 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8024 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8025 | */ |
| 8026 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8027 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8028 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8029 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8030 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8031 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8032 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8033 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8034 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8035 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8036 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8037 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8038 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8039 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8040 | { } /* end */ |
| 8041 | }; |
| 8042 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8043 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8044 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8045 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8046 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8047 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8048 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8049 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8050 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8051 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8052 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8053 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8054 | { } /* end */ |
| 8055 | }; |
| 8056 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8057 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8058 | { |
| 8059 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8060 | .name = "Channel Mode", |
| 8061 | .info = alc_ch_mode_info, |
| 8062 | .get = alc_ch_mode_get, |
| 8063 | .put = alc_ch_mode_put, |
| 8064 | }, |
| 8065 | { } /* end */ |
| 8066 | }; |
| 8067 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8068 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8069 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8070 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8072 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8073 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8074 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8075 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8076 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8077 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8078 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8079 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8080 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8081 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8082 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8083 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8084 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8085 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8086 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8087 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8088 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8089 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8090 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8091 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8092 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8093 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8094 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8095 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8096 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8097 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8098 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8099 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8100 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8101 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8102 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8103 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8104 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8105 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8106 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8107 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8108 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8109 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8110 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8111 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8112 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8113 | |
| 8114 | /* FIXME: use matrix-type input source selection */ |
| 8115 | /* 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] | 8116 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8117 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8118 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8119 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8120 | /* ADC2: mute amp left and right */ |
| 8121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8122 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8123 | /* ADC3: mute amp left and right */ |
| 8124 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8125 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8126 | |
| 8127 | { } |
| 8128 | }; |
| 8129 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8130 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8131 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8132 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8133 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8134 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8135 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8136 | /* ADC1: mute amp left and right */ |
| 8137 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8138 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8139 | { } |
| 8140 | }; |
| 8141 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8142 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8143 | /* change to EAPD mode */ |
| 8144 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8145 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8146 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8147 | }; |
| 8148 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8149 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8150 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8151 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8152 | { } |
| 8153 | }; |
| 8154 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8155 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8156 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8157 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8158 | {} |
| 8159 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8160 | |
| 8161 | static struct hda_verb alc885_init_verbs[] = { |
| 8162 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8163 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8164 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8165 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8166 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8167 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8168 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8169 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8170 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8171 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8172 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8173 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8174 | |
| 8175 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8176 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8177 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8178 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8179 | /* Front Pin: output 0 (0x0c) */ |
| 8180 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8181 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8182 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8183 | /* Rear Pin: output 1 (0x0d) */ |
| 8184 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8185 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8186 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8187 | /* CLFE Pin: output 2 (0x0e) */ |
| 8188 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8189 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8190 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8191 | /* Side Pin: output 3 (0x0f) */ |
| 8192 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8193 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8194 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8195 | /* Mic (rear) pin: input vref at 80% */ |
| 8196 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8197 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8198 | /* Front Mic pin: input vref at 80% */ |
| 8199 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8200 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8201 | /* Line In pin: input */ |
| 8202 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8203 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8204 | |
| 8205 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8206 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8207 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8208 | /* Input mixer2 */ |
| 8209 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8210 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8211 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8212 | /* ADC2: mute amp left and right */ |
| 8213 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8214 | /* ADC3: mute amp left and right */ |
| 8215 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8216 | |
| 8217 | { } |
| 8218 | }; |
| 8219 | |
| 8220 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8221 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8222 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8223 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8224 | { } |
| 8225 | }; |
| 8226 | |
| 8227 | |
| 8228 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8229 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8230 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8231 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8232 | { } |
| 8233 | }; |
| 8234 | |
| 8235 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8236 | #define alc883_init_verbs alc882_base_init_verbs |
| 8237 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8238 | /* Mac Pro test */ |
| 8239 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8240 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8241 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8242 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8243 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8244 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8245 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8246 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8247 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8248 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8249 | { } /* end */ |
| 8250 | }; |
| 8251 | |
| 8252 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8253 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8254 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8255 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8256 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8257 | /* Front Pin: output 0 (0x0c) */ |
| 8258 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8259 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8260 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8261 | /* Front Mic pin: input vref at 80% */ |
| 8262 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8263 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8264 | /* Speaker: output */ |
| 8265 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8266 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8267 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8268 | /* Headphone output (output 0 - 0x0c) */ |
| 8269 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8270 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8271 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8272 | |
| 8273 | /* FIXME: use matrix-type input source selection */ |
| 8274 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8275 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8276 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8277 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8278 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8279 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8280 | /* Input mixer2 */ |
| 8281 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8282 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8283 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8284 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8285 | /* Input mixer3 */ |
| 8286 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8287 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8288 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8289 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8290 | /* ADC1: mute amp left and right */ |
| 8291 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8292 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8293 | /* ADC2: mute amp left and right */ |
| 8294 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8295 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8296 | /* ADC3: mute amp left and right */ |
| 8297 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8298 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8299 | |
| 8300 | { } |
| 8301 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8302 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8303 | /* Macbook 5,1 */ |
| 8304 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8305 | /* DACs */ |
| 8306 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8307 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8308 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8309 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8310 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8311 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8312 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8313 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8314 | /* Surround mixer */ |
| 8315 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8316 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8317 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8318 | /* LFE mixer */ |
| 8319 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8320 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8321 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8322 | /* HP mixer */ |
| 8323 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8324 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8325 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8326 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8327 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8328 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8329 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8330 | /* LFE Pin (0x0e) */ |
| 8331 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8332 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8333 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8334 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8335 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8336 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8337 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8338 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8339 | /* Front Mic pin: input vref at 80% */ |
| 8340 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8341 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8342 | /* Line In pin */ |
| 8343 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8344 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8345 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8346 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8347 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8348 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8349 | { } |
| 8350 | }; |
| 8351 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8352 | /* Macmini 3,1 */ |
| 8353 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8354 | /* DACs */ |
| 8355 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8356 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8357 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8358 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8359 | /* Front mixer */ |
| 8360 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8361 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8363 | /* Surround mixer */ |
| 8364 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8365 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8366 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8367 | /* LFE mixer */ |
| 8368 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8369 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8370 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8371 | /* HP mixer */ |
| 8372 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8373 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8374 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8375 | /* Front Pin (0x0c) */ |
| 8376 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8377 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8378 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8379 | /* LFE Pin (0x0e) */ |
| 8380 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8381 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8382 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8383 | /* HP Pin (0x0f) */ |
| 8384 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8385 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8386 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8387 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8388 | /* Line In pin */ |
| 8389 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8390 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8391 | |
| 8392 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8393 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8394 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8395 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8396 | { } |
| 8397 | }; |
| 8398 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8399 | |
| 8400 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8401 | /*Internal and HP Speaker Mixer*/ |
| 8402 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8403 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8404 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8405 | /*Internal Speaker Pin (0x0c)*/ |
| 8406 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8407 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8408 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8409 | /* HP Pin: output 0 (0x0e) */ |
| 8410 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8411 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8412 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8413 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8414 | /* Line in (is hp when jack connected)*/ |
| 8415 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8416 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8417 | |
| 8418 | { } |
| 8419 | }; |
| 8420 | |
| 8421 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8422 | /* Macbook Pro rev3 */ |
| 8423 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8424 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8426 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8427 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8428 | /* Rear mixer */ |
| 8429 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8430 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8431 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8432 | /* HP mixer */ |
| 8433 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8434 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8435 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8436 | /* Front Pin: output 0 (0x0c) */ |
| 8437 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8438 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8439 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8440 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8441 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8442 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8443 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8444 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8445 | /* Mic (rear) pin: input vref at 80% */ |
| 8446 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8447 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8448 | /* Front Mic pin: input vref at 80% */ |
| 8449 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8450 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8451 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8452 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8453 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8454 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8455 | |
| 8456 | /* FIXME: use matrix-type input source selection */ |
| 8457 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8458 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8459 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8460 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8461 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8462 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8463 | /* Input mixer2 */ |
| 8464 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8465 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8466 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8467 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8468 | /* Input mixer3 */ |
| 8469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8470 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8471 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8472 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8473 | /* ADC1: mute amp left and right */ |
| 8474 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8475 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8476 | /* ADC2: mute amp left and right */ |
| 8477 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8478 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8479 | /* ADC3: mute amp left and right */ |
| 8480 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8481 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8482 | |
| 8483 | { } |
| 8484 | }; |
| 8485 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8486 | /* iMac 9,1 */ |
| 8487 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8488 | /* Internal Speaker Pin (0x0c) */ |
| 8489 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8490 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8491 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8492 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8493 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8494 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8495 | /* HP Pin: Rear */ |
| 8496 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8497 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8498 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8499 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8500 | /* Line in Rear */ |
| 8501 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8502 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8503 | /* Front Mic pin: input vref at 80% */ |
| 8504 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8505 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8506 | /* Rear mixer */ |
| 8507 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8508 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8509 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8510 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8511 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8512 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8513 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8514 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8515 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8516 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8517 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8518 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8519 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8520 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8521 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8522 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8523 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8524 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8527 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8528 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8529 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8530 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8531 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8532 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8533 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8534 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8535 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8536 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8537 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8538 | { } |
| 8539 | }; |
| 8540 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8541 | /* iMac 24 mixer. */ |
| 8542 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8543 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8544 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8545 | { } /* end */ |
| 8546 | }; |
| 8547 | |
| 8548 | /* iMac 24 init verbs. */ |
| 8549 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8550 | /* Internal speakers: output 0 (0x0c) */ |
| 8551 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8552 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8553 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8554 | /* Internal speakers: output 0 (0x0c) */ |
| 8555 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8556 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8557 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8558 | /* Headphone: output 0 (0x0c) */ |
| 8559 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8560 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8561 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8562 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8563 | /* Front Mic: input vref at 80% */ |
| 8564 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8565 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8566 | { } |
| 8567 | }; |
| 8568 | |
| 8569 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8570 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8571 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8572 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8573 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8574 | spec->autocfg.hp_pins[0] = 0x14; |
| 8575 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8576 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8577 | } |
| 8578 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8579 | #define alc885_mb5_setup alc885_imac24_setup |
| 8580 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8581 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8582 | /* Macbook Air 2,1 */ |
| 8583 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8584 | { |
| 8585 | struct alc_spec *spec = codec->spec; |
| 8586 | |
| 8587 | spec->autocfg.hp_pins[0] = 0x14; |
| 8588 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8589 | } |
| 8590 | |
| 8591 | |
| 8592 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8593 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8594 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8595 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8596 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8597 | spec->autocfg.hp_pins[0] = 0x15; |
| 8598 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8599 | } |
| 8600 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8601 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8602 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8603 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8604 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8605 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8606 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8607 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8608 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8609 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8610 | static struct hda_verb alc882_targa_verbs[] = { |
| 8611 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8612 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8613 | |
| 8614 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8615 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8616 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8617 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8618 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8619 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8620 | |
| 8621 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8622 | { } /* end */ |
| 8623 | }; |
| 8624 | |
| 8625 | /* toggle speaker-output according to the hp-jack state */ |
| 8626 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8627 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8628 | struct alc_spec *spec = codec->spec; |
| 8629 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8630 | 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] | 8631 | spec->jack_present ? 1 : 3); |
| 8632 | } |
| 8633 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8634 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8635 | { |
| 8636 | struct alc_spec *spec = codec->spec; |
| 8637 | |
| 8638 | spec->autocfg.hp_pins[0] = 0x14; |
| 8639 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8640 | } |
| 8641 | |
| 8642 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8643 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8644 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8645 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8646 | } |
| 8647 | |
| 8648 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8649 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8650 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8651 | |
| 8652 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8653 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8654 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8655 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8656 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8657 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8658 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8659 | |
| 8660 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8661 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8662 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8663 | { } /* end */ |
| 8664 | }; |
| 8665 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8666 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8667 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8668 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8669 | |
| 8670 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8671 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8672 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8673 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8674 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8675 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8676 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8677 | |
| 8678 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8679 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8680 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8681 | { } /* end */ |
| 8682 | }; |
| 8683 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8684 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8685 | { |
| 8686 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8687 | |
| 8688 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8689 | AC_VERB_GET_GPIO_DATA, 0); |
| 8690 | |
| 8691 | if (!muted) |
| 8692 | gpiostate |= (1 << pin); |
| 8693 | else |
| 8694 | gpiostate &= ~(1 << pin); |
| 8695 | |
| 8696 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8697 | AC_VERB_GET_GPIO_MASK, 0); |
| 8698 | gpiomask |= (1 << pin); |
| 8699 | |
| 8700 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8701 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8702 | gpiodir |= (1 << pin); |
| 8703 | |
| 8704 | |
| 8705 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8706 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8707 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8708 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8709 | |
| 8710 | msleep(1); |
| 8711 | |
| 8712 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8713 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8714 | } |
| 8715 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8716 | /* set up GPIO at initialization */ |
| 8717 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8718 | { |
| 8719 | alc882_gpio_mute(codec, 0, 0); |
| 8720 | alc882_gpio_mute(codec, 1, 0); |
| 8721 | } |
| 8722 | |
| 8723 | /* set up GPIO and update auto-muting at initialization */ |
| 8724 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8725 | { |
| 8726 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8727 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8728 | } |
| 8729 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8730 | /* |
| 8731 | * generic initialization of ADC, input mixers and output mixers |
| 8732 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8733 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8734 | /* |
| 8735 | * Unmute ADC0-2 and set the default input to mic-in |
| 8736 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8737 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8738 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8739 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8740 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8741 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8742 | /* |
| 8743 | * Set up output mixers (0x0c - 0x0f) |
| 8744 | */ |
| 8745 | /* set vol=0 to output mixers */ |
| 8746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8747 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8748 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8749 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8750 | /* set up input amps for analog loopback */ |
| 8751 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8752 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8753 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8754 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8755 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8756 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8757 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8758 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8759 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8760 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8761 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8762 | |
| 8763 | /* FIXME: use matrix-type input source selection */ |
| 8764 | /* 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] | 8765 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8766 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8767 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8768 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8769 | { } |
| 8770 | }; |
| 8771 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8772 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8773 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8774 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8775 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8776 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8777 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8778 | { } /* end */ |
| 8779 | }; |
| 8780 | |
| 8781 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8782 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8783 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8784 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8785 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8786 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8787 | { } /* end */ |
| 8788 | }; |
| 8789 | |
| 8790 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8791 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8792 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8793 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8794 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8795 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8796 | { } /* end */ |
| 8797 | }; |
| 8798 | |
| 8799 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8800 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8801 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8802 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8803 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8804 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8805 | { } /* end */ |
| 8806 | }; |
| 8807 | |
| 8808 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8809 | { 2, alc889A_mb31_ch2_init }, |
| 8810 | { 4, alc889A_mb31_ch4_init }, |
| 8811 | { 5, alc889A_mb31_ch5_init }, |
| 8812 | { 6, alc889A_mb31_ch6_init }, |
| 8813 | }; |
| 8814 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8815 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8816 | /* eanable EAPD on medion laptop */ |
| 8817 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8818 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8819 | { } |
| 8820 | }; |
| 8821 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8822 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8823 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8824 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8825 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8826 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8827 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8828 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8829 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8830 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8831 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8832 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8833 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8835 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8836 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8837 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8838 | { } /* end */ |
| 8839 | }; |
| 8840 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8841 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8842 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8843 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8844 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8845 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8846 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8847 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8848 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8849 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8850 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8851 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8852 | { } /* end */ |
| 8853 | }; |
| 8854 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8855 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8856 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8857 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8858 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8859 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8860 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8861 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8862 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8863 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8864 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8865 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8866 | { } /* end */ |
| 8867 | }; |
| 8868 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8869 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8870 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8871 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8872 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8873 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8874 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8875 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8876 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8877 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8878 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8880 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8881 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8882 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8883 | { } /* end */ |
| 8884 | }; |
| 8885 | |
| 8886 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8887 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8888 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8889 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8890 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8891 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8892 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8893 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8894 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8895 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8896 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8897 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8898 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8899 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8900 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8901 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8902 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8903 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8904 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8905 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8906 | { } /* end */ |
| 8907 | }; |
| 8908 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8909 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8910 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8911 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8912 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8913 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8914 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8915 | HDA_OUTPUT), |
| 8916 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8917 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8918 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8919 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8920 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8921 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8922 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8923 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8924 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8925 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8926 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8927 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8928 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8929 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8930 | { } /* end */ |
| 8931 | }; |
| 8932 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8933 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8934 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8935 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8936 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8937 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8938 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8939 | HDA_OUTPUT), |
| 8940 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8941 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8942 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8943 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8944 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8945 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8946 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8947 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8948 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8949 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8950 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8951 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8952 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8953 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8954 | { } /* end */ |
| 8955 | }; |
| 8956 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8957 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8958 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8959 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8960 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8961 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8962 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8963 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8964 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8965 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8966 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8967 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8968 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8969 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8970 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8971 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8972 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8973 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8974 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8975 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8976 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8977 | { } /* end */ |
| 8978 | }; |
| 8979 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8980 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8981 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8982 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8983 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8984 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8985 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8986 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8987 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8988 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8989 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8990 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8991 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8992 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8993 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8994 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8996 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8997 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8998 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8999 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9000 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9001 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9002 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9003 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9004 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9005 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9006 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9007 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9008 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9009 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9010 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9011 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9012 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9013 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9014 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9015 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9016 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9017 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 9018 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9019 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9020 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9021 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9022 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9023 | { } /* end */ |
| 9024 | }; |
| 9025 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9026 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9027 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9028 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9029 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9030 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9031 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9032 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9033 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9034 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9035 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9036 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9037 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9038 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9039 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9040 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9041 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9042 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9043 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9044 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9045 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, 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), |
| 9047 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9048 | { } /* end */ |
| 9049 | }; |
| 9050 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9051 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9052 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9053 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9054 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9055 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9056 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9057 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9058 | { } /* end */ |
| 9059 | }; |
| 9060 | |
| 9061 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9062 | /* Unmute front mixer */ |
| 9063 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9064 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9065 | |
| 9066 | /* Set speaker pin to front mixer */ |
| 9067 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9068 | |
| 9069 | /* Init headphone pin */ |
| 9070 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9071 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9072 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9073 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9074 | |
| 9075 | { } /* end */ |
| 9076 | }; |
| 9077 | |
| 9078 | /* toggle speaker-output according to the hp-jack state */ |
| 9079 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9080 | { |
| 9081 | struct alc_spec *spec = codec->spec; |
| 9082 | |
| 9083 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9084 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9085 | } |
| 9086 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9087 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9088 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9089 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9090 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9091 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9092 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9094 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9095 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9096 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9097 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9098 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9099 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9100 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9101 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9102 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9103 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9104 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9105 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9106 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9107 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9109 | { } /* end */ |
| 9110 | }; |
| 9111 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9112 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9113 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9114 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9115 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9116 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9117 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9118 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9119 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9120 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9121 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9122 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9123 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9124 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9125 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9126 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9127 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9128 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9129 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9131 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9132 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9133 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9134 | { } /* end */ |
| 9135 | }; |
| 9136 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9137 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9138 | /* Output mixers */ |
| 9139 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9140 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9141 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9142 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9143 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9144 | HDA_OUTPUT), |
| 9145 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9146 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9147 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9148 | /* Output switches */ |
| 9149 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9150 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9151 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9152 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9153 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9154 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9155 | /* Input mixers */ |
| 9156 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9157 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9158 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9159 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9160 | { } /* end */ |
| 9161 | }; |
| 9162 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9163 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9164 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9165 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9166 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9167 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9168 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9170 | { } /* end */ |
| 9171 | }; |
| 9172 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9173 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9174 | .ops = &snd_hda_bind_vol, |
| 9175 | .values = { |
| 9176 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9177 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9178 | 0 |
| 9179 | }, |
| 9180 | }; |
| 9181 | |
| 9182 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9183 | .ops = &snd_hda_bind_sw, |
| 9184 | .values = { |
| 9185 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9186 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9187 | 0 |
| 9188 | }, |
| 9189 | }; |
| 9190 | |
| 9191 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9193 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9194 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9195 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9196 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9197 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9198 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9200 | { } /* end */ |
| 9201 | }; |
| 9202 | |
| 9203 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9204 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9205 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9206 | { |
| 9207 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9208 | /* .name = "Capture Source", */ |
| 9209 | .name = "Input Source", |
| 9210 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9211 | .info = alc_mux_enum_info, |
| 9212 | .get = alc_mux_enum_get, |
| 9213 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9214 | }, |
| 9215 | { } /* end */ |
| 9216 | }; |
| 9217 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9218 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9219 | { |
| 9220 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9221 | .name = "Channel Mode", |
| 9222 | .info = alc_ch_mode_info, |
| 9223 | .get = alc_ch_mode_get, |
| 9224 | .put = alc_ch_mode_put, |
| 9225 | }, |
| 9226 | { } /* end */ |
| 9227 | }; |
| 9228 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9229 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9230 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9231 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9232 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9233 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9234 | spec->autocfg.hp_pins[0] = 0x15; |
| 9235 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9236 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9237 | } |
| 9238 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9239 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9240 | /* HP */ |
| 9241 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9242 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9243 | /* Subwoofer */ |
| 9244 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9245 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9246 | |
| 9247 | /* enable unsolicited event */ |
| 9248 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9249 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9250 | |
| 9251 | { } /* end */ |
| 9252 | }; |
| 9253 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9254 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9255 | /* HP */ |
| 9256 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9257 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9258 | /* Int speaker */ |
| 9259 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9260 | |
| 9261 | /* enable unsolicited event */ |
| 9262 | /* |
| 9263 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9264 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9265 | */ |
| 9266 | |
| 9267 | { } /* end */ |
| 9268 | }; |
| 9269 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9270 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9271 | /* HP */ |
| 9272 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9273 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9274 | /* Int speaker */ |
| 9275 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9276 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9277 | |
| 9278 | /* enable unsolicited event */ |
| 9279 | {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] | 9280 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9281 | |
| 9282 | { } /* end */ |
| 9283 | }; |
| 9284 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9285 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9286 | /* HP */ |
| 9287 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9288 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9289 | /* Subwoofer */ |
| 9290 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9291 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9292 | |
| 9293 | /* enable unsolicited event */ |
| 9294 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9295 | |
| 9296 | { } /* end */ |
| 9297 | }; |
| 9298 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9299 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9300 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9301 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9302 | |
| 9303 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9304 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9305 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9306 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9307 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9308 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9309 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9310 | /* Connect Mic jack to CLFE */ |
| 9311 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9312 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9313 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9314 | /* Connect Line-in jack to Surround */ |
| 9315 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9316 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9317 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9318 | /* Connect HP out jack to Front */ |
| 9319 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9320 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9321 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9322 | |
| 9323 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9324 | |
| 9325 | { } /* end */ |
| 9326 | }; |
| 9327 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9328 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9329 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9330 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9331 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9332 | { } /* end */ |
| 9333 | }; |
| 9334 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9335 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9336 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9337 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9338 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9339 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9340 | { } /* end */ |
| 9341 | }; |
| 9342 | |
| 9343 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9344 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9346 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9347 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9348 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9349 | { } /* end */ |
| 9350 | }; |
| 9351 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9352 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9353 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9354 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9355 | |
| 9356 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9357 | |
| 9358 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9359 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9360 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9361 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9362 | { } /* end */ |
| 9363 | }; |
| 9364 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9365 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9368 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9369 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9370 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9371 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9372 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9373 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9374 | { } /* end */ |
| 9375 | }; |
| 9376 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9377 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9378 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9379 | { } |
| 9380 | }; |
| 9381 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9382 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9383 | /* HP */ |
| 9384 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9385 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9386 | |
| 9387 | /* enable unsolicited event */ |
| 9388 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9389 | |
| 9390 | { } /* end */ |
| 9391 | }; |
| 9392 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9393 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9394 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9395 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9396 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9397 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9398 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9399 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9400 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9401 | } |
| 9402 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9403 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9404 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9405 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9406 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9407 | {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] | 9408 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9409 | }; |
| 9410 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9411 | /* |
| 9412 | * 2ch mode |
| 9413 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9414 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9415 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9416 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9417 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9418 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9419 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9420 | }; |
| 9421 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9422 | /* |
| 9423 | * 4ch mode |
| 9424 | */ |
| 9425 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9426 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9427 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9428 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9429 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9430 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9431 | { } /* end */ |
| 9432 | }; |
| 9433 | |
| 9434 | /* |
| 9435 | * 6ch mode |
| 9436 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9437 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9438 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9439 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9440 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9441 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9442 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9443 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9444 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9445 | }; |
| 9446 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9447 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9448 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9449 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9450 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9451 | }; |
| 9452 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9453 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9454 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9455 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9456 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9457 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9458 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9459 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9460 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9461 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9462 | } |
| 9463 | |
| 9464 | /* toggle RCA according to the front-jack state */ |
| 9465 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9466 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9467 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9468 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9469 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9470 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9471 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9472 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9473 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9474 | unsigned int res) |
| 9475 | { |
| 9476 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9477 | alc888_lenovo_ms7195_front_automute(codec); |
| 9478 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9479 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9480 | } |
| 9481 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9482 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9483 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9484 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9485 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9486 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9487 | spec->autocfg.hp_pins[0] = 0x14; |
| 9488 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9489 | } |
| 9490 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9491 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9492 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9493 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9494 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9495 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9496 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9497 | struct alc_spec *spec = codec->spec; |
| 9498 | |
| 9499 | spec->autocfg.hp_pins[0] = 0x15; |
| 9500 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9501 | } |
| 9502 | |
| 9503 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9504 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9505 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9506 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9507 | } |
| 9508 | |
| 9509 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9510 | unsigned int res) |
| 9511 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9512 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9513 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9514 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9515 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9516 | default: |
| 9517 | alc_automute_amp_unsol_event(codec, res); |
| 9518 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9519 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9520 | } |
| 9521 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9522 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9523 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9524 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9525 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9526 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9527 | spec->autocfg.hp_pins[0] = 0x14; |
| 9528 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9529 | } |
| 9530 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9531 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9532 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9533 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9534 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9535 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9536 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9537 | } |
| 9538 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9539 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9540 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9541 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9542 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9543 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9544 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9545 | } |
| 9546 | |
| 9547 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9548 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9549 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9550 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9551 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9552 | HDA_AMP_MUTE, bits); |
| 9553 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9554 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9555 | } |
| 9556 | |
| 9557 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9558 | unsigned int res) |
| 9559 | { |
| 9560 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9561 | alc883_lenovo_101e_all_automute(codec); |
| 9562 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9563 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9564 | } |
| 9565 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9566 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9567 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9568 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9569 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9570 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9571 | spec->autocfg.hp_pins[0] = 0x14; |
| 9572 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9573 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9574 | } |
| 9575 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9576 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9577 | /* HP Pin: output 0 (0x0c) */ |
| 9578 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9579 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9580 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9581 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9582 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9583 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9584 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9585 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9586 | /* eanable EAPD on medion laptop */ |
| 9587 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9588 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9589 | /* enable unsolicited event */ |
| 9590 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9591 | { } |
| 9592 | }; |
| 9593 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9594 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9595 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9596 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9597 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9598 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9599 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9600 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9601 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9602 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9603 | } |
| 9604 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9605 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9606 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9607 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9608 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9609 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9610 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9611 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9612 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9613 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9614 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9615 | } |
| 9616 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9617 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9618 | { |
| 9619 | struct alc_spec *spec = codec->spec; |
| 9620 | |
| 9621 | spec->autocfg.hp_pins[0] = 0x15; |
| 9622 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9623 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9624 | } |
| 9625 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9626 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9627 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9628 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9629 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9630 | /* enable unsolicited event */ |
| 9631 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9632 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9633 | { } /* end */ |
| 9634 | }; |
| 9635 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9636 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9637 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9638 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9639 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9640 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9641 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9642 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9643 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9644 | spec->ext_mic.pin = 0x18; |
| 9645 | spec->int_mic.pin = 0x19; |
| 9646 | spec->ext_mic.mux_idx = 0; |
| 9647 | spec->int_mic.mux_idx = 1; |
| 9648 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9649 | } |
| 9650 | |
| 9651 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9652 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9653 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9654 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9655 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9656 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9657 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9658 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9659 | /* enable unsolicited event */ |
| 9660 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9661 | { } /* end */ |
| 9662 | }; |
| 9663 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9664 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9665 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9666 | struct alc_spec *spec = codec->spec; |
| 9667 | |
| 9668 | spec->autocfg.hp_pins[0] = 0x14; |
| 9669 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9670 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9671 | } |
| 9672 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9673 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9674 | /* Init rear pin (used as headphone output) */ |
| 9675 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9676 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9677 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9678 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9679 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9680 | /* Init line 2 pin (used as headphone out by default) */ |
| 9681 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9682 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9683 | { } /* end */ |
| 9684 | }; |
| 9685 | |
| 9686 | /* Mute speakers according to the headphone jack state */ |
| 9687 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9688 | { |
| 9689 | unsigned int present; |
| 9690 | |
| 9691 | /* Mute only in 2ch or 4ch mode */ |
| 9692 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9693 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9694 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9695 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9696 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9697 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9698 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9699 | } |
| 9700 | } |
| 9701 | |
| 9702 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9703 | { |
| 9704 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9705 | alc889A_mb31_automute(codec); |
| 9706 | } |
| 9707 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9708 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9709 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9710 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9711 | #endif |
| 9712 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9713 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9714 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9715 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9716 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9717 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9718 | |
| 9719 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9720 | ALC1200_DIGOUT_NID, 0, |
| 9721 | }; |
| 9722 | |
| 9723 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9724 | ALC883_DIGOUT_NID, 0, |
| 9725 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9726 | |
| 9727 | /* |
| 9728 | * configuration and preset |
| 9729 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9730 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9731 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9732 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9733 | [ALC882_ARIMA] = "arima", |
| 9734 | [ALC882_W2JC] = "w2jc", |
| 9735 | [ALC882_TARGA] = "targa", |
| 9736 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9737 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9738 | [ALC885_MACPRO] = "macpro", |
| 9739 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9740 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9741 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9742 | [ALC885_MBP3] = "mbp3", |
| 9743 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9744 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9745 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9746 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9747 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9748 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9749 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9750 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9751 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9752 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9753 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9754 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9755 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9756 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9757 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9758 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9759 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9760 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9761 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9762 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9763 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9764 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9765 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9766 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9767 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9768 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9769 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9770 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9771 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9772 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9773 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9774 | [ALC889A_INTEL] = "intel-alc889a", |
| 9775 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9776 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9777 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9778 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9779 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9780 | }; |
| 9781 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9782 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9783 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9784 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9785 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9786 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9787 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9788 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9789 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9790 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9791 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9792 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9793 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9794 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9795 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9796 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9797 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9798 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9799 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9800 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9801 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9802 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9803 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9804 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9805 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9806 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9807 | /* default Acer -- disabled as it causes more problems. |
| 9808 | * model=auto should work fine now |
| 9809 | */ |
| 9810 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9811 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9812 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9813 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9814 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9815 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9816 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9817 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9818 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9819 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9820 | |
| 9821 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9822 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9823 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9824 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9825 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9826 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9827 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9828 | 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] | 9829 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9830 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9831 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9832 | |
| 9833 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9834 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9835 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9836 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9837 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9838 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9839 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9840 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9841 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9842 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9843 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9844 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9845 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9846 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9847 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9848 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9849 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9850 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9851 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9852 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9853 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9854 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9855 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9856 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9857 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9858 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9859 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9860 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9861 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9862 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9863 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9864 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9865 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9866 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9867 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9868 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9869 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9870 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9871 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9872 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9873 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9874 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9875 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9876 | 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] | 9877 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9878 | 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] | 9879 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9880 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9881 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9882 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9883 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9884 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9885 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9886 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9887 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9888 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9889 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9890 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9891 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9892 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9893 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9894 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9895 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9896 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9897 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9898 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9899 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9900 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9901 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9902 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9903 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9904 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9905 | {} |
| 9906 | }; |
| 9907 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9908 | /* codec SSID table for Intel Mac */ |
| 9909 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9910 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9911 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9912 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9913 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9914 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9915 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9916 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9917 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9918 | 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] | 9919 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9920 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9921 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9922 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9923 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9924 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9925 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9926 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9927 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9928 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9929 | */ |
| 9930 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9931 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9932 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9933 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9934 | }; |
| 9935 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9936 | static struct alc_config_preset alc882_presets[] = { |
| 9937 | [ALC882_3ST_DIG] = { |
| 9938 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9939 | .init_verbs = { alc882_base_init_verbs, |
| 9940 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9941 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9942 | .dac_nids = alc882_dac_nids, |
| 9943 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9944 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9945 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9946 | .channel_mode = alc882_ch_modes, |
| 9947 | .need_dac_fix = 1, |
| 9948 | .input_mux = &alc882_capture_source, |
| 9949 | }, |
| 9950 | [ALC882_6ST_DIG] = { |
| 9951 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9952 | .init_verbs = { alc882_base_init_verbs, |
| 9953 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9954 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9955 | .dac_nids = alc882_dac_nids, |
| 9956 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9957 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9958 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9959 | .channel_mode = alc882_sixstack_modes, |
| 9960 | .input_mux = &alc882_capture_source, |
| 9961 | }, |
| 9962 | [ALC882_ARIMA] = { |
| 9963 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9964 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9965 | alc882_eapd_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 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9969 | .channel_mode = alc882_sixstack_modes, |
| 9970 | .input_mux = &alc882_capture_source, |
| 9971 | }, |
| 9972 | [ALC882_W2JC] = { |
| 9973 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9974 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9975 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9976 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9977 | .dac_nids = alc882_dac_nids, |
| 9978 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9979 | .channel_mode = alc880_threestack_modes, |
| 9980 | .need_dac_fix = 1, |
| 9981 | .input_mux = &alc882_capture_source, |
| 9982 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9983 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9984 | [ALC885_MBA21] = { |
| 9985 | .mixers = { alc885_mba21_mixer }, |
| 9986 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9987 | .num_dacs = 2, |
| 9988 | .dac_nids = alc882_dac_nids, |
| 9989 | .channel_mode = alc885_mba21_ch_modes, |
| 9990 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9991 | .input_mux = &alc882_capture_source, |
| 9992 | .unsol_event = alc_automute_amp_unsol_event, |
| 9993 | .setup = alc885_mba21_setup, |
| 9994 | .init_hook = alc_automute_amp, |
| 9995 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9996 | [ALC885_MBP3] = { |
| 9997 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9998 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9999 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10000 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10001 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10002 | .hp_nid = 0x04, |
| 10003 | .channel_mode = alc885_mbp_4ch_modes, |
| 10004 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10005 | .input_mux = &alc882_capture_source, |
| 10006 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10007 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10008 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10009 | .setup = alc885_mbp3_setup, |
| 10010 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10011 | }, |
| 10012 | [ALC885_MB5] = { |
| 10013 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10014 | .init_verbs = { alc885_mb5_init_verbs, |
| 10015 | alc880_gpio1_init_verbs }, |
| 10016 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10017 | .dac_nids = alc882_dac_nids, |
| 10018 | .channel_mode = alc885_mb5_6ch_modes, |
| 10019 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10020 | .input_mux = &mb5_capture_source, |
| 10021 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10022 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10023 | .unsol_event = alc_automute_amp_unsol_event, |
| 10024 | .setup = alc885_mb5_setup, |
| 10025 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10026 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10027 | [ALC885_MACMINI3] = { |
| 10028 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10029 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10030 | alc880_gpio1_init_verbs }, |
| 10031 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10032 | .dac_nids = alc882_dac_nids, |
| 10033 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10034 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10035 | .input_mux = &macmini3_capture_source, |
| 10036 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10037 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10038 | .unsol_event = alc_automute_amp_unsol_event, |
| 10039 | .setup = alc885_macmini3_setup, |
| 10040 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10041 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10042 | [ALC885_MACPRO] = { |
| 10043 | .mixers = { alc882_macpro_mixer }, |
| 10044 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10045 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10046 | .dac_nids = alc882_dac_nids, |
| 10047 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10048 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10049 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10050 | .channel_mode = alc882_ch_modes, |
| 10051 | .input_mux = &alc882_capture_source, |
| 10052 | .init_hook = alc885_macpro_init_hook, |
| 10053 | }, |
| 10054 | [ALC885_IMAC24] = { |
| 10055 | .mixers = { alc885_imac24_mixer }, |
| 10056 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10057 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10058 | .dac_nids = alc882_dac_nids, |
| 10059 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10060 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10061 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10062 | .channel_mode = alc882_ch_modes, |
| 10063 | .input_mux = &alc882_capture_source, |
| 10064 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10065 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10066 | .init_hook = alc885_imac24_init_hook, |
| 10067 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10068 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10069 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10070 | .init_verbs = { alc885_imac91_init_verbs, |
| 10071 | alc880_gpio1_init_verbs }, |
| 10072 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10073 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10074 | .channel_mode = alc885_mba21_ch_modes, |
| 10075 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10076 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10077 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10078 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10079 | .unsol_event = alc_automute_amp_unsol_event, |
| 10080 | .setup = alc885_imac91_setup, |
| 10081 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10082 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10083 | [ALC882_TARGA] = { |
| 10084 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10085 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10086 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10087 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10088 | .dac_nids = alc882_dac_nids, |
| 10089 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10090 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10091 | .adc_nids = alc882_adc_nids, |
| 10092 | .capsrc_nids = alc882_capsrc_nids, |
| 10093 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10094 | .channel_mode = alc882_3ST_6ch_modes, |
| 10095 | .need_dac_fix = 1, |
| 10096 | .input_mux = &alc882_capture_source, |
| 10097 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10098 | .setup = alc882_targa_setup, |
| 10099 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10100 | }, |
| 10101 | [ALC882_ASUS_A7J] = { |
| 10102 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10103 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10104 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10105 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10106 | .dac_nids = alc882_dac_nids, |
| 10107 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10108 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10109 | .adc_nids = alc882_adc_nids, |
| 10110 | .capsrc_nids = alc882_capsrc_nids, |
| 10111 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10112 | .channel_mode = alc882_3ST_6ch_modes, |
| 10113 | .need_dac_fix = 1, |
| 10114 | .input_mux = &alc882_capture_source, |
| 10115 | }, |
| 10116 | [ALC882_ASUS_A7M] = { |
| 10117 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10118 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10119 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10120 | alc882_asus_a7m_verbs }, |
| 10121 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10122 | .dac_nids = alc882_dac_nids, |
| 10123 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10124 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10125 | .channel_mode = alc880_threestack_modes, |
| 10126 | .need_dac_fix = 1, |
| 10127 | .input_mux = &alc882_capture_source, |
| 10128 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10129 | [ALC883_3ST_2ch_DIG] = { |
| 10130 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10131 | .init_verbs = { alc883_init_verbs }, |
| 10132 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10133 | .dac_nids = alc883_dac_nids, |
| 10134 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10135 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10136 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10137 | .channel_mode = alc883_3ST_2ch_modes, |
| 10138 | .input_mux = &alc883_capture_source, |
| 10139 | }, |
| 10140 | [ALC883_3ST_6ch_DIG] = { |
| 10141 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10142 | .init_verbs = { alc883_init_verbs }, |
| 10143 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10144 | .dac_nids = alc883_dac_nids, |
| 10145 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10146 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10147 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10148 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10149 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10150 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10151 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10152 | [ALC883_3ST_6ch] = { |
| 10153 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10154 | .init_verbs = { alc883_init_verbs }, |
| 10155 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10156 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10157 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10158 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10159 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10160 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10161 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10162 | [ALC883_3ST_6ch_INTEL] = { |
| 10163 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10164 | .init_verbs = { alc883_init_verbs }, |
| 10165 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10166 | .dac_nids = alc883_dac_nids, |
| 10167 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10168 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10169 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10170 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10171 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10172 | .need_dac_fix = 1, |
| 10173 | .input_mux = &alc883_3stack_6ch_intel, |
| 10174 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10175 | [ALC889A_INTEL] = { |
| 10176 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10177 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10178 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10179 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10180 | .dac_nids = alc883_dac_nids, |
| 10181 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10182 | .adc_nids = alc889_adc_nids, |
| 10183 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10184 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10185 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10186 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10187 | .channel_mode = alc889_8ch_intel_modes, |
| 10188 | .capsrc_nids = alc889_capsrc_nids, |
| 10189 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10190 | .setup = alc889_automute_setup, |
| 10191 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10192 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10193 | .need_dac_fix = 1, |
| 10194 | }, |
| 10195 | [ALC889_INTEL] = { |
| 10196 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10197 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10198 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10199 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10200 | .dac_nids = alc883_dac_nids, |
| 10201 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10202 | .adc_nids = alc889_adc_nids, |
| 10203 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10204 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10205 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10206 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10207 | .channel_mode = alc889_8ch_intel_modes, |
| 10208 | .capsrc_nids = alc889_capsrc_nids, |
| 10209 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10210 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10211 | .init_hook = alc889_intel_init_hook, |
| 10212 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10213 | .need_dac_fix = 1, |
| 10214 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10215 | [ALC883_6ST_DIG] = { |
| 10216 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10217 | .init_verbs = { alc883_init_verbs }, |
| 10218 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10219 | .dac_nids = alc883_dac_nids, |
| 10220 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10221 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10222 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10223 | .channel_mode = alc883_sixstack_modes, |
| 10224 | .input_mux = &alc883_capture_source, |
| 10225 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10226 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10227 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10228 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10229 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10230 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10231 | .dac_nids = alc883_dac_nids, |
| 10232 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10233 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10234 | .channel_mode = alc883_3ST_6ch_modes, |
| 10235 | .need_dac_fix = 1, |
| 10236 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10237 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10238 | .setup = alc882_targa_setup, |
| 10239 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10240 | }, |
| 10241 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10242 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10243 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10244 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10245 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10246 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10247 | .adc_nids = alc883_adc_nids_alt, |
| 10248 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10249 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10250 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10251 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10252 | .channel_mode = alc883_3ST_2ch_modes, |
| 10253 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10254 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10255 | .setup = alc882_targa_setup, |
| 10256 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10257 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10258 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10259 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10260 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10261 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10262 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10263 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10264 | .dac_nids = alc883_dac_nids, |
| 10265 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10266 | .adc_nids = alc883_adc_nids_rev, |
| 10267 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10268 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10269 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10270 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10271 | .channel_mode = alc883_4ST_8ch_modes, |
| 10272 | .need_dac_fix = 1, |
| 10273 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10274 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10275 | .setup = alc882_targa_setup, |
| 10276 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10277 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10278 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10279 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10280 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10281 | * and the headphone jack. Turn this on and rely on the |
| 10282 | * standard mute methods whenever the user wants to turn |
| 10283 | * these outputs off. |
| 10284 | */ |
| 10285 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10286 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10287 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10288 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10289 | .channel_mode = alc883_3ST_2ch_modes, |
| 10290 | .input_mux = &alc883_capture_source, |
| 10291 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10292 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10293 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10294 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10295 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10296 | .dac_nids = alc883_dac_nids, |
| 10297 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10298 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10299 | .channel_mode = alc883_3ST_2ch_modes, |
| 10300 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10301 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10302 | .setup = alc883_acer_aspire_setup, |
| 10303 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10304 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10305 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10306 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10307 | alc883_chmode_mixer }, |
| 10308 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10309 | alc888_acer_aspire_4930g_verbs }, |
| 10310 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10311 | .dac_nids = alc883_dac_nids, |
| 10312 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10313 | .adc_nids = alc883_adc_nids_rev, |
| 10314 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10315 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10316 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10317 | .channel_mode = alc883_3ST_6ch_modes, |
| 10318 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10319 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10320 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10321 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10322 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10323 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10324 | .setup = alc888_acer_aspire_4930g_setup, |
| 10325 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10326 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10327 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10328 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10329 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10330 | alc888_acer_aspire_6530g_verbs }, |
| 10331 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10332 | .dac_nids = alc883_dac_nids, |
| 10333 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10334 | .adc_nids = alc883_adc_nids_rev, |
| 10335 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10336 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10337 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10338 | .channel_mode = alc883_3ST_2ch_modes, |
| 10339 | .num_mux_defs = |
| 10340 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10341 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10342 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10343 | .setup = alc888_acer_aspire_6530g_setup, |
| 10344 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10345 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10346 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10347 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10348 | alc883_chmode_mixer }, |
| 10349 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10350 | alc889_acer_aspire_8930g_verbs, |
| 10351 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10352 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10353 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10354 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10355 | .adc_nids = alc889_adc_nids, |
| 10356 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10357 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10358 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10359 | .channel_mode = alc883_3ST_6ch_modes, |
| 10360 | .need_dac_fix = 1, |
| 10361 | .const_channel_count = 6, |
| 10362 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10363 | ARRAY_SIZE(alc889_capture_sources), |
| 10364 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10365 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10366 | .setup = alc889_acer_aspire_8930g_setup, |
| 10367 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10368 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10369 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10370 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10371 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10372 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10373 | .mixers = { alc883_3ST_6ch_mixer, |
| 10374 | alc883_chmode_mixer }, |
| 10375 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10376 | alc888_acer_aspire_7730G_verbs }, |
| 10377 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10378 | .dac_nids = alc883_dac_nids, |
| 10379 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10380 | .adc_nids = alc883_adc_nids_rev, |
| 10381 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 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 | .input_mux = &alc883_capture_source, |
| 10388 | .unsol_event = alc_automute_amp_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10389 | .setup = alc888_acer_aspire_7730g_setup, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10390 | .init_hook = alc_automute_amp, |
| 10391 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10392 | [ALC883_MEDION] = { |
| 10393 | .mixers = { alc883_fivestack_mixer, |
| 10394 | alc883_chmode_mixer }, |
| 10395 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10396 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10397 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10398 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10399 | .adc_nids = alc883_adc_nids_alt, |
| 10400 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10401 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10402 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10403 | .channel_mode = alc883_sixstack_modes, |
| 10404 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10405 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10406 | [ALC883_MEDION_WIM2160] = { |
| 10407 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10408 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10409 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10410 | .dac_nids = alc883_dac_nids, |
| 10411 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10412 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10413 | .adc_nids = alc883_adc_nids, |
| 10414 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10415 | .channel_mode = alc883_3ST_2ch_modes, |
| 10416 | .input_mux = &alc883_capture_source, |
| 10417 | .unsol_event = alc_automute_amp_unsol_event, |
| 10418 | .setup = alc883_medion_wim2160_setup, |
| 10419 | .init_hook = alc_automute_amp, |
| 10420 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10421 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10422 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10423 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10424 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10425 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10426 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10427 | .channel_mode = alc883_3ST_2ch_modes, |
| 10428 | .input_mux = &alc883_capture_source, |
| 10429 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10430 | [ALC883_CLEVO_M540R] = { |
| 10431 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10432 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10433 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10434 | .dac_nids = alc883_dac_nids, |
| 10435 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10436 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10437 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10438 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10439 | .need_dac_fix = 1, |
| 10440 | .input_mux = &alc883_capture_source, |
| 10441 | /* This machine has the hardware HP auto-muting, thus |
| 10442 | * we need no software mute via unsol event |
| 10443 | */ |
| 10444 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10445 | [ALC883_CLEVO_M720] = { |
| 10446 | .mixers = { alc883_clevo_m720_mixer }, |
| 10447 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10448 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10449 | .dac_nids = alc883_dac_nids, |
| 10450 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10451 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10452 | .channel_mode = alc883_3ST_2ch_modes, |
| 10453 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10454 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10455 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10456 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10457 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10458 | [ALC883_LENOVO_101E_2ch] = { |
| 10459 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10460 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10461 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10462 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10463 | .adc_nids = alc883_adc_nids_alt, |
| 10464 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10465 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10466 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10467 | .channel_mode = alc883_3ST_2ch_modes, |
| 10468 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10469 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10470 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10471 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10472 | [ALC883_LENOVO_NB0763] = { |
| 10473 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10474 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10475 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10476 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10477 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10478 | .channel_mode = alc883_3ST_2ch_modes, |
| 10479 | .need_dac_fix = 1, |
| 10480 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10481 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10482 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10483 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10484 | }, |
| 10485 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10486 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10487 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10488 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10489 | .dac_nids = alc883_dac_nids, |
| 10490 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10491 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10492 | .channel_mode = alc883_3ST_6ch_modes, |
| 10493 | .need_dac_fix = 1, |
| 10494 | .input_mux = &alc883_capture_source, |
| 10495 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10496 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10497 | }, |
| 10498 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10499 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10500 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10501 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10502 | .dac_nids = alc883_dac_nids, |
| 10503 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10504 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10505 | .channel_mode = alc883_3ST_2ch_modes, |
| 10506 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10507 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10508 | .setup = alc883_haier_w66_setup, |
| 10509 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10510 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10511 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10512 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10513 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10514 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10515 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10516 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10517 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10518 | .need_dac_fix = 1, |
| 10519 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10520 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10521 | .setup = alc888_3st_hp_setup, |
| 10522 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10523 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10524 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10525 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10526 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10527 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10528 | .dac_nids = alc883_dac_nids, |
| 10529 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10530 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10531 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10532 | .channel_mode = alc883_sixstack_modes, |
| 10533 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10534 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10535 | .setup = alc888_6st_dell_setup, |
| 10536 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10537 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10538 | [ALC883_MITAC] = { |
| 10539 | .mixers = { alc883_mitac_mixer }, |
| 10540 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10541 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10542 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10543 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10544 | .channel_mode = alc883_3ST_2ch_modes, |
| 10545 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10546 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10547 | .setup = alc883_mitac_setup, |
| 10548 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10549 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10550 | [ALC883_FUJITSU_PI2515] = { |
| 10551 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10552 | .init_verbs = { alc883_init_verbs, |
| 10553 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10554 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10555 | .dac_nids = alc883_dac_nids, |
| 10556 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10557 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10558 | .channel_mode = alc883_3ST_2ch_modes, |
| 10559 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10560 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10561 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10562 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10563 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10564 | [ALC888_FUJITSU_XA3530] = { |
| 10565 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10566 | .init_verbs = { alc883_init_verbs, |
| 10567 | alc888_fujitsu_xa3530_verbs }, |
| 10568 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10569 | .dac_nids = alc883_dac_nids, |
| 10570 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10571 | .adc_nids = alc883_adc_nids_rev, |
| 10572 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10573 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10574 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10575 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10576 | .num_mux_defs = |
| 10577 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10578 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10579 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10580 | .setup = alc888_fujitsu_xa3530_setup, |
| 10581 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10582 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10583 | [ALC888_LENOVO_SKY] = { |
| 10584 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10585 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10586 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10587 | .dac_nids = alc883_dac_nids, |
| 10588 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10589 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10590 | .channel_mode = alc883_sixstack_modes, |
| 10591 | .need_dac_fix = 1, |
| 10592 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10593 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10594 | .setup = alc888_lenovo_sky_setup, |
| 10595 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10596 | }, |
| 10597 | [ALC888_ASUS_M90V] = { |
| 10598 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10599 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10600 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10601 | .dac_nids = alc883_dac_nids, |
| 10602 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10603 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10604 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10605 | .channel_mode = alc883_3ST_6ch_modes, |
| 10606 | .need_dac_fix = 1, |
| 10607 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10608 | .unsol_event = alc_sku_unsol_event, |
| 10609 | .setup = alc883_mode2_setup, |
| 10610 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10611 | }, |
| 10612 | [ALC888_ASUS_EEE1601] = { |
| 10613 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10614 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10615 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10616 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10617 | .dac_nids = alc883_dac_nids, |
| 10618 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10619 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10620 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10621 | .channel_mode = alc883_3ST_2ch_modes, |
| 10622 | .need_dac_fix = 1, |
| 10623 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10624 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10625 | .init_hook = alc883_eee1601_inithook, |
| 10626 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10627 | [ALC1200_ASUS_P5Q] = { |
| 10628 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10629 | .init_verbs = { alc883_init_verbs }, |
| 10630 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10631 | .dac_nids = alc883_dac_nids, |
| 10632 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10633 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10634 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10635 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10636 | .channel_mode = alc883_sixstack_modes, |
| 10637 | .input_mux = &alc883_capture_source, |
| 10638 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10639 | [ALC889A_MB31] = { |
| 10640 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10641 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10642 | alc880_gpio1_init_verbs }, |
| 10643 | .adc_nids = alc883_adc_nids, |
| 10644 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10645 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10646 | .dac_nids = alc883_dac_nids, |
| 10647 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10648 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10649 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10650 | .input_mux = &alc889A_mb31_capture_source, |
| 10651 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10652 | .unsol_event = alc889A_mb31_unsol_event, |
| 10653 | .init_hook = alc889A_mb31_automute, |
| 10654 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10655 | [ALC883_SONY_VAIO_TT] = { |
| 10656 | .mixers = { alc883_vaiott_mixer }, |
| 10657 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10658 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10659 | .dac_nids = alc883_dac_nids, |
| 10660 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10661 | .channel_mode = alc883_3ST_2ch_modes, |
| 10662 | .input_mux = &alc883_capture_source, |
| 10663 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10664 | .setup = alc883_vaiott_setup, |
| 10665 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10666 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10667 | }; |
| 10668 | |
| 10669 | |
| 10670 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10671 | * Pin config fixes |
| 10672 | */ |
| 10673 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10674 | PINFIX_ABIT_AW9D_MAX, |
| 10675 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10676 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10677 | }; |
| 10678 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10679 | static const struct alc_fixup alc882_fixups[] = { |
| 10680 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10681 | .pins = (const struct alc_pincfg[]) { |
| 10682 | { 0x15, 0x01080104 }, /* side */ |
| 10683 | { 0x16, 0x01011012 }, /* rear */ |
| 10684 | { 0x17, 0x01016011 }, /* clfe */ |
| 10685 | { } |
| 10686 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10687 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10688 | [PINFIX_PB_M5210] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10689 | .verbs = (const struct hda_verb[]) { |
| 10690 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10691 | {} |
| 10692 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10693 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10694 | [PINFIX_ACER_ASPIRE_7736] = { |
| 10695 | .sku = ALC_FIXUP_SKU_IGNORE, |
| 10696 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10697 | }; |
| 10698 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10699 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10700 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10701 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10702 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10703 | {} |
| 10704 | }; |
| 10705 | |
| 10706 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10707 | * BIOS auto configuration |
| 10708 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10709 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10710 | const struct auto_pin_cfg *cfg) |
| 10711 | { |
| 10712 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10713 | } |
| 10714 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10715 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10716 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10717 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10718 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10719 | int idx; |
| 10720 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10721 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10722 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10723 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10724 | if (dac == 0x25) |
| 10725 | idx = 4; |
| 10726 | else if (dac >= 0x02 && dac <= 0x05) |
| 10727 | idx = dac - 2; |
| 10728 | else |
| 10729 | return; |
| 10730 | 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] | 10731 | } |
| 10732 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10733 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10734 | { |
| 10735 | struct alc_spec *spec = codec->spec; |
| 10736 | int i; |
| 10737 | |
| 10738 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10739 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10740 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10741 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10742 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10743 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10744 | } |
| 10745 | } |
| 10746 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10747 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10748 | { |
| 10749 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10750 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10751 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10752 | |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10753 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10754 | pin = spec->autocfg.hp_pins[i]; |
| 10755 | if (!pin) |
| 10756 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10757 | dac = spec->multiout.hp_nid; |
| 10758 | if (!dac) |
| 10759 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10760 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10761 | } |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10762 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10763 | pin = spec->autocfg.speaker_pins[i]; |
| 10764 | if (!pin) |
| 10765 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10766 | dac = spec->multiout.extra_out_nid[0]; |
| 10767 | if (!dac) |
| 10768 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10769 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10770 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10771 | } |
| 10772 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10773 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10774 | { |
| 10775 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10776 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10777 | int i; |
| 10778 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10779 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10780 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10781 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10782 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10783 | snd_hda_codec_write(codec, nid, 0, |
| 10784 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10785 | AMP_OUT_MUTE); |
| 10786 | } |
| 10787 | } |
| 10788 | |
| 10789 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10790 | { |
| 10791 | struct alc_spec *spec = codec->spec; |
| 10792 | int c; |
| 10793 | |
| 10794 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10795 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10796 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10797 | unsigned int mux_idx; |
| 10798 | const struct hda_input_mux *imux; |
| 10799 | int conns, mute, idx, item; |
| 10800 | |
| 10801 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10802 | ARRAY_SIZE(conn_list)); |
| 10803 | if (conns < 0) |
| 10804 | continue; |
| 10805 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10806 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10807 | if (!imux->num_items && mux_idx > 0) |
| 10808 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10809 | for (idx = 0; idx < conns; idx++) { |
| 10810 | /* if the current connection is the selected one, |
| 10811 | * unmute it as default - otherwise mute it |
| 10812 | */ |
| 10813 | mute = AMP_IN_MUTE(idx); |
| 10814 | for (item = 0; item < imux->num_items; item++) { |
| 10815 | if (imux->items[item].index == idx) { |
| 10816 | if (spec->cur_mux[c] == item) |
| 10817 | mute = AMP_IN_UNMUTE(idx); |
| 10818 | break; |
| 10819 | } |
| 10820 | } |
| 10821 | /* check if we have a selector or mixer |
| 10822 | * we could check for the widget type instead, but |
| 10823 | * just check for Amp-In presence (in case of mixer |
| 10824 | * without amp-in there is something wrong, this |
| 10825 | * function shouldn't be used or capsrc nid is wrong) |
| 10826 | */ |
| 10827 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10828 | snd_hda_codec_write(codec, nid, 0, |
| 10829 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10830 | mute); |
| 10831 | else if (mute != AMP_IN_MUTE(idx)) |
| 10832 | snd_hda_codec_write(codec, nid, 0, |
| 10833 | AC_VERB_SET_CONNECT_SEL, |
| 10834 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10835 | } |
| 10836 | } |
| 10837 | } |
| 10838 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10839 | /* add mic boosts if needed */ |
| 10840 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10841 | { |
| 10842 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10843 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10844 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10845 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10846 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10847 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10848 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10849 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10850 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10851 | break; |
| 10852 | nid = cfg->inputs[i].pin; |
| 10853 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10854 | const char *label; |
| 10855 | char boost_label[32]; |
| 10856 | |
| 10857 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 10858 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10859 | type_idx++; |
| 10860 | else |
| 10861 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10862 | prev_label = label; |
| 10863 | |
| 10864 | snprintf(boost_label, sizeof(boost_label), |
| 10865 | "%s Boost Volume", label); |
| 10866 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10867 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10868 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10869 | if (err < 0) |
| 10870 | return err; |
| 10871 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10872 | } |
| 10873 | return 0; |
| 10874 | } |
| 10875 | |
| 10876 | /* almost identical with ALC880 parser... */ |
| 10877 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10878 | { |
| 10879 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10880 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10881 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10882 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10883 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10884 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10885 | if (err < 0) |
| 10886 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10887 | if (!spec->autocfg.line_outs) |
| 10888 | return 0; /* can't find valid BIOS pin config */ |
| 10889 | |
| 10890 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10891 | if (err < 0) |
| 10892 | return err; |
| 10893 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10894 | if (err < 0) |
| 10895 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10896 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10897 | "Headphone"); |
| 10898 | if (err < 0) |
| 10899 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10900 | err = alc880_auto_create_extra_out(spec, |
| 10901 | spec->autocfg.speaker_pins[0], |
| 10902 | "Speaker"); |
| 10903 | if (err < 0) |
| 10904 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10905 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10906 | if (err < 0) |
| 10907 | return err; |
| 10908 | |
| 10909 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10910 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10911 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10912 | |
| 10913 | if (spec->kctls.list) |
| 10914 | add_mixer(spec, spec->kctls.list); |
| 10915 | |
| 10916 | add_verb(spec, alc883_auto_init_verbs); |
| 10917 | /* if ADC 0x07 is available, initialize it, too */ |
| 10918 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10919 | add_verb(spec, alc882_adc1_init_verbs); |
| 10920 | |
| 10921 | spec->num_mux_defs = 1; |
| 10922 | spec->input_mux = &spec->private_imux[0]; |
| 10923 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10924 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10925 | |
| 10926 | err = alc_auto_add_mic_boost(codec); |
| 10927 | if (err < 0) |
| 10928 | return err; |
| 10929 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10930 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10931 | } |
| 10932 | |
| 10933 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10934 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10935 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10936 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10937 | alc882_auto_init_multi_out(codec); |
| 10938 | alc882_auto_init_hp_out(codec); |
| 10939 | alc882_auto_init_analog_input(codec); |
| 10940 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10941 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10942 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10943 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10944 | } |
| 10945 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10946 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10947 | { |
| 10948 | struct alc_spec *spec; |
| 10949 | int err, board_config; |
| 10950 | |
| 10951 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10952 | if (spec == NULL) |
| 10953 | return -ENOMEM; |
| 10954 | |
| 10955 | codec->spec = spec; |
| 10956 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10957 | switch (codec->vendor_id) { |
| 10958 | case 0x10ec0882: |
| 10959 | case 0x10ec0885: |
| 10960 | break; |
| 10961 | default: |
| 10962 | /* ALC883 and variants */ |
| 10963 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10964 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10965 | } |
| 10966 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10967 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10968 | alc882_models, |
| 10969 | alc882_cfg_tbl); |
| 10970 | |
| 10971 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10972 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10973 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10974 | |
| 10975 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10976 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10977 | codec->chip_name); |
| 10978 | board_config = ALC882_AUTO; |
| 10979 | } |
| 10980 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10981 | if (board_config == ALC882_AUTO) |
| 10982 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10983 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 10984 | alc_auto_parse_customize_define(codec); |
| 10985 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10986 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10987 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10988 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10989 | if (err < 0) { |
| 10990 | alc_free(codec); |
| 10991 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10992 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10993 | printk(KERN_INFO |
| 10994 | "hda_codec: Cannot set up configuration " |
| 10995 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10996 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10997 | } |
| 10998 | } |
| 10999 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11000 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11001 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11002 | if (err < 0) { |
| 11003 | alc_free(codec); |
| 11004 | return err; |
| 11005 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11006 | } |
| 11007 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11008 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11009 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11010 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11011 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11012 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11013 | /* FIXME: setup DAC5 */ |
| 11014 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11015 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11016 | |
| 11017 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11018 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11019 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11020 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11021 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11022 | spec->num_adc_nids = 0; |
| 11023 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11024 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11025 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11026 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11027 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11028 | unsigned int wcap = get_wcaps(codec, nid); |
| 11029 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11030 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11031 | if (wcap != AC_WID_AUD_IN) |
| 11032 | continue; |
| 11033 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11034 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11035 | if (err < 0) |
| 11036 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11037 | err = snd_hda_get_connections(codec, cap, items, |
| 11038 | ARRAY_SIZE(items)); |
| 11039 | if (err < 0) |
| 11040 | continue; |
| 11041 | for (j = 0; j < imux->num_items; j++) |
| 11042 | if (imux->items[j].index >= err) |
| 11043 | break; |
| 11044 | if (j < imux->num_items) |
| 11045 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11046 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11047 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11048 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11049 | spec->adc_nids = spec->private_adc_nids; |
| 11050 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11051 | } |
| 11052 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11053 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11054 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11055 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11056 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11057 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11058 | if (board_config == ALC882_AUTO) |
| 11059 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 11060 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11061 | spec->vmaster_nid = 0x0c; |
| 11062 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11063 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11064 | if (board_config == ALC882_AUTO) |
| 11065 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11066 | |
| 11067 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11068 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11069 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11070 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11071 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11072 | |
| 11073 | return 0; |
| 11074 | } |
| 11075 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11076 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11077 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11078 | * ALC262 support |
| 11079 | */ |
| 11080 | |
| 11081 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11082 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11083 | |
| 11084 | #define alc262_dac_nids alc260_dac_nids |
| 11085 | #define alc262_adc_nids alc882_adc_nids |
| 11086 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11087 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11088 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11089 | |
| 11090 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11091 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11092 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11093 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11094 | /* ADC0 */ |
| 11095 | 0x09 |
| 11096 | }; |
| 11097 | |
| 11098 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11099 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11100 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11101 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11102 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11103 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11104 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11105 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11106 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11109 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11110 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11111 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11112 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11113 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11114 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11115 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11116 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11117 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11118 | }; |
| 11119 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11120 | /* update HP, line and mono-out pins according to the master switch */ |
| 11121 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 11122 | { |
| 11123 | struct alc_spec *spec = codec->spec; |
| 11124 | int val = spec->master_sw; |
| 11125 | |
| 11126 | /* HP & line-out */ |
| 11127 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 11128 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11129 | val ? PIN_HP : 0); |
| 11130 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11131 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11132 | val ? PIN_HP : 0); |
| 11133 | /* mono (speaker) depending on the HP jack sense */ |
| 11134 | val = val && !spec->jack_present; |
| 11135 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11136 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11137 | val ? PIN_OUT : 0); |
| 11138 | } |
| 11139 | |
| 11140 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11141 | { |
| 11142 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11143 | |
| 11144 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11145 | alc262_hp_master_update(codec); |
| 11146 | } |
| 11147 | |
| 11148 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11149 | { |
| 11150 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11151 | return; |
| 11152 | alc262_hp_bpc_automute(codec); |
| 11153 | } |
| 11154 | |
| 11155 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11156 | { |
| 11157 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11158 | |
| 11159 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11160 | alc262_hp_master_update(codec); |
| 11161 | } |
| 11162 | |
| 11163 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11164 | unsigned int res) |
| 11165 | { |
| 11166 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11167 | return; |
| 11168 | alc262_hp_wildwest_automute(codec); |
| 11169 | } |
| 11170 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11171 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11172 | |
| 11173 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11174 | struct snd_ctl_elem_value *ucontrol) |
| 11175 | { |
| 11176 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11177 | struct alc_spec *spec = codec->spec; |
| 11178 | int val = !!*ucontrol->value.integer.value; |
| 11179 | |
| 11180 | if (val == spec->master_sw) |
| 11181 | return 0; |
| 11182 | spec->master_sw = val; |
| 11183 | alc262_hp_master_update(codec); |
| 11184 | return 1; |
| 11185 | } |
| 11186 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11187 | #define ALC262_HP_MASTER_SWITCH \ |
| 11188 | { \ |
| 11189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11190 | .name = "Master Playback Switch", \ |
| 11191 | .info = snd_ctl_boolean_mono_info, \ |
| 11192 | .get = alc262_hp_master_sw_get, \ |
| 11193 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11194 | }, \ |
| 11195 | { \ |
| 11196 | .iface = NID_MAPPING, \ |
| 11197 | .name = "Master Playback Switch", \ |
| 11198 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11199 | } |
| 11200 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11201 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11202 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11203 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11204 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11205 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11206 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11207 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11208 | HDA_OUTPUT), |
| 11209 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11210 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11211 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11212 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11213 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11214 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11215 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11216 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11217 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11218 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11219 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11220 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11221 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11222 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11223 | { } /* end */ |
| 11224 | }; |
| 11225 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11226 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11227 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11228 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11229 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11230 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11231 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11232 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11233 | HDA_OUTPUT), |
| 11234 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11235 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11236 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11237 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11238 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11239 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11240 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11241 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11242 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11243 | { } /* end */ |
| 11244 | }; |
| 11245 | |
| 11246 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11247 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11248 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11249 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11250 | { } /* end */ |
| 11251 | }; |
| 11252 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11253 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11254 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11255 | { |
| 11256 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11257 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11258 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11259 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11260 | } |
| 11261 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11262 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11263 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11264 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11265 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11266 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11267 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11268 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11269 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11270 | { } /* end */ |
| 11271 | }; |
| 11272 | |
| 11273 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11274 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11275 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11276 | |
| 11277 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11278 | { } |
| 11279 | }; |
| 11280 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11281 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11282 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11283 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11284 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11285 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11286 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11287 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11288 | { } /* end */ |
| 11289 | }; |
| 11290 | |
| 11291 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11292 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11293 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11294 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11295 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11296 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11297 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11299 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11300 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11301 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11302 | {} |
| 11303 | }; |
| 11304 | |
| 11305 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11306 | .num_items = 1, |
| 11307 | .items = { |
| 11308 | { "Line", 0x1 }, |
| 11309 | }, |
| 11310 | }; |
| 11311 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11312 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11313 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11314 | { |
| 11315 | struct alc_spec *spec = codec->spec; |
| 11316 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11317 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11318 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11319 | unsigned int mute; |
| 11320 | |
| 11321 | /* HP */ |
| 11322 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11323 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11324 | HDA_AMP_MUTE, mute); |
| 11325 | /* mute internal speaker per jack sense */ |
| 11326 | if (spec->jack_present) |
| 11327 | mute = HDA_AMP_MUTE; |
| 11328 | if (line_nid) |
| 11329 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11330 | HDA_AMP_MUTE, mute); |
| 11331 | if (speaker_nid && speaker_nid != line_nid) |
| 11332 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11333 | HDA_AMP_MUTE, mute); |
| 11334 | } |
| 11335 | |
| 11336 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11337 | |
| 11338 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11339 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11340 | { |
| 11341 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11342 | struct alc_spec *spec = codec->spec; |
| 11343 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11344 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11345 | if (val == spec->master_sw) |
| 11346 | return 0; |
| 11347 | spec->master_sw = val; |
| 11348 | alc262_hippo_master_update(codec); |
| 11349 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11350 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11351 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11352 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11353 | { \ |
| 11354 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11355 | .name = "Master Playback Switch", \ |
| 11356 | .info = snd_ctl_boolean_mono_info, \ |
| 11357 | .get = alc262_hippo_master_sw_get, \ |
| 11358 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11359 | }, \ |
| 11360 | { \ |
| 11361 | .iface = NID_MAPPING, \ |
| 11362 | .name = "Master Playback Switch", \ |
| 11363 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11364 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11365 | } |
| 11366 | |
| 11367 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11368 | ALC262_HIPPO_MASTER_SWITCH, |
| 11369 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11370 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11371 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11372 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11373 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11374 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11375 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11376 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11377 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11378 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11379 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11380 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11381 | { } /* end */ |
| 11382 | }; |
| 11383 | |
| 11384 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11385 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11386 | ALC262_HIPPO_MASTER_SWITCH, |
| 11387 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11388 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11389 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11390 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11391 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11392 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11393 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11394 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11395 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11396 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11397 | { } /* end */ |
| 11398 | }; |
| 11399 | |
| 11400 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11401 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11402 | { |
| 11403 | struct alc_spec *spec = codec->spec; |
| 11404 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11405 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11406 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11407 | alc262_hippo_master_update(codec); |
| 11408 | } |
| 11409 | |
| 11410 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11411 | { |
| 11412 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11413 | return; |
| 11414 | alc262_hippo_automute(codec); |
| 11415 | } |
| 11416 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11417 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11418 | { |
| 11419 | struct alc_spec *spec = codec->spec; |
| 11420 | |
| 11421 | spec->autocfg.hp_pins[0] = 0x15; |
| 11422 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11423 | } |
| 11424 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11425 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11426 | { |
| 11427 | struct alc_spec *spec = codec->spec; |
| 11428 | |
| 11429 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11430 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11431 | } |
| 11432 | |
| 11433 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11434 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11435 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11436 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11437 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11438 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11439 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11440 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11441 | { } /* end */ |
| 11442 | }; |
| 11443 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11444 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11445 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11446 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11447 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11448 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11449 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11450 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11451 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11452 | { } /* end */ |
| 11453 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11454 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11455 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11456 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11457 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11458 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11459 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11460 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11461 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11462 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11463 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11464 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11465 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11466 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11467 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11468 | { } /* end */ |
| 11469 | }; |
| 11470 | |
| 11471 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11472 | /* Headphone automute */ |
| 11473 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11474 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11475 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11476 | |
| 11477 | /* P11 AUX_IN, white 4-pin connector */ |
| 11478 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11479 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11480 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11481 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11482 | |
| 11483 | {} |
| 11484 | }; |
| 11485 | |
| 11486 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11487 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11488 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11489 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11490 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11491 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11492 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11493 | } |
| 11494 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11495 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11496 | #define alc262_capture_mixer alc882_capture_mixer |
| 11497 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11498 | |
| 11499 | /* |
| 11500 | * generic initialization of ADC, input mixers and output mixers |
| 11501 | */ |
| 11502 | static struct hda_verb alc262_init_verbs[] = { |
| 11503 | /* |
| 11504 | * Unmute ADC0-2 and set the default input to mic-in |
| 11505 | */ |
| 11506 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11508 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11509 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11510 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11511 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11512 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11513 | /* 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] | 11514 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11515 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11516 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11517 | */ |
| 11518 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11521 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11522 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11523 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11524 | |
| 11525 | /* |
| 11526 | * Set up output mixers (0x0c - 0x0e) |
| 11527 | */ |
| 11528 | /* set vol=0 to output mixers */ |
| 11529 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11530 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11531 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11532 | /* set up input amps for analog loopback */ |
| 11533 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11534 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11535 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11536 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11537 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11538 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11539 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11540 | |
| 11541 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11542 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11543 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11544 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11545 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11546 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11547 | |
| 11548 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11549 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11550 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11551 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11552 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11553 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11554 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11555 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11556 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11557 | /* FIXME: use matrix-type input source selection */ |
| 11558 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11559 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11560 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11561 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11562 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11563 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11564 | /* Input mixer2 */ |
| 11565 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11566 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11567 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11568 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11569 | /* Input mixer3 */ |
| 11570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11571 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11572 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11573 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11574 | |
| 11575 | { } |
| 11576 | }; |
| 11577 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11578 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11579 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11580 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11581 | { } |
| 11582 | }; |
| 11583 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11584 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11585 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11586 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11587 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11588 | |
| 11589 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11590 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11591 | {} |
| 11592 | }; |
| 11593 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11594 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11595 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11596 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11597 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11598 | |
| 11599 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11600 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11601 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11602 | }; |
| 11603 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11604 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11605 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11606 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11607 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11608 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11609 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11610 | { } /* end */ |
| 11611 | }; |
| 11612 | |
| 11613 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11614 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11615 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11616 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11617 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11618 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11619 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11620 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11621 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11622 | {} |
| 11623 | }; |
| 11624 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11625 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11626 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11627 | struct alc_spec *spec = codec->spec; |
| 11628 | |
| 11629 | spec->autocfg.hp_pins[0] = 0x15; |
| 11630 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11631 | spec->ext_mic.pin = 0x18; |
| 11632 | spec->ext_mic.mux_idx = 0; |
| 11633 | spec->int_mic.pin = 0x12; |
| 11634 | spec->int_mic.mux_idx = 9; |
| 11635 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11636 | } |
| 11637 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11638 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11639 | * nec model |
| 11640 | * 0x15 = headphone |
| 11641 | * 0x16 = internal speaker |
| 11642 | * 0x18 = external mic |
| 11643 | */ |
| 11644 | |
| 11645 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11646 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11647 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11648 | |
| 11649 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11650 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11651 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11652 | |
| 11653 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11654 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11655 | { } /* end */ |
| 11656 | }; |
| 11657 | |
| 11658 | static struct hda_verb alc262_nec_verbs[] = { |
| 11659 | /* Unmute Speaker */ |
| 11660 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11661 | |
| 11662 | /* Headphone */ |
| 11663 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11664 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11665 | |
| 11666 | /* External mic to headphone */ |
| 11667 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11668 | /* External mic to speaker */ |
| 11669 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11670 | {} |
| 11671 | }; |
| 11672 | |
| 11673 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11674 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11675 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11676 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11677 | */ |
| 11678 | |
| 11679 | #define ALC_HP_EVENT 0x37 |
| 11680 | |
| 11681 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11682 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11683 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11684 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11685 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11686 | {} |
| 11687 | }; |
| 11688 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11689 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11690 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11691 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11692 | {} |
| 11693 | }; |
| 11694 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11695 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11696 | /* Front Mic pin: input vref at 50% */ |
| 11697 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11698 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11699 | {} |
| 11700 | }; |
| 11701 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11702 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11703 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11704 | .items = { |
| 11705 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11706 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11707 | { "CD", 0x4 }, |
| 11708 | }, |
| 11709 | }; |
| 11710 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11711 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11712 | .num_items = 5, |
| 11713 | .items = { |
| 11714 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11715 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11716 | { "Line", 0x2 }, |
| 11717 | { "CD", 0x4 }, |
| 11718 | { "AUX IN", 0x6 }, |
| 11719 | }, |
| 11720 | }; |
| 11721 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11722 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11723 | .num_items = 4, |
| 11724 | .items = { |
| 11725 | { "Mic", 0x0 }, |
| 11726 | { "Front Mic", 0x2 }, |
| 11727 | { "Line", 0x1 }, |
| 11728 | { "CD", 0x4 }, |
| 11729 | }, |
| 11730 | }; |
| 11731 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11732 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11733 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11734 | { |
| 11735 | struct alc_spec *spec = codec->spec; |
| 11736 | unsigned int mute; |
| 11737 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11738 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11739 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11740 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11741 | spec->sense_updated = 1; |
| 11742 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11743 | /* unmute internal speaker only if both HPs are unplugged and |
| 11744 | * master switch is on |
| 11745 | */ |
| 11746 | if (spec->jack_present) |
| 11747 | mute = HDA_AMP_MUTE; |
| 11748 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11749 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11750 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11751 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11752 | } |
| 11753 | |
| 11754 | /* unsolicited event for HP jack sensing */ |
| 11755 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11756 | unsigned int res) |
| 11757 | { |
| 11758 | if ((res >> 26) != ALC_HP_EVENT) |
| 11759 | return; |
| 11760 | alc262_fujitsu_automute(codec, 1); |
| 11761 | } |
| 11762 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11763 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11764 | { |
| 11765 | alc262_fujitsu_automute(codec, 1); |
| 11766 | } |
| 11767 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11768 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11769 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11770 | .ops = &snd_hda_bind_vol, |
| 11771 | .values = { |
| 11772 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11773 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11774 | 0 |
| 11775 | }, |
| 11776 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11777 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11778 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11779 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11780 | { |
| 11781 | struct alc_spec *spec = codec->spec; |
| 11782 | unsigned int mute; |
| 11783 | |
| 11784 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11785 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11786 | spec->sense_updated = 1; |
| 11787 | } |
| 11788 | if (spec->jack_present) { |
| 11789 | /* mute internal speaker */ |
| 11790 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11791 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11792 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11793 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11794 | } else { |
| 11795 | /* unmute internal speaker if necessary */ |
| 11796 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11797 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11798 | HDA_AMP_MUTE, mute); |
| 11799 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11800 | HDA_AMP_MUTE, mute); |
| 11801 | } |
| 11802 | } |
| 11803 | |
| 11804 | /* unsolicited event for HP jack sensing */ |
| 11805 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11806 | unsigned int res) |
| 11807 | { |
| 11808 | if ((res >> 26) != ALC_HP_EVENT) |
| 11809 | return; |
| 11810 | alc262_lenovo_3000_automute(codec, 1); |
| 11811 | } |
| 11812 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11813 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11814 | int dir, int idx, long *valp) |
| 11815 | { |
| 11816 | int i, change = 0; |
| 11817 | |
| 11818 | for (i = 0; i < 2; i++, valp++) |
| 11819 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11820 | HDA_AMP_MUTE, |
| 11821 | *valp ? 0 : HDA_AMP_MUTE); |
| 11822 | return change; |
| 11823 | } |
| 11824 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11825 | /* bind hp and internal speaker mute (with plug check) */ |
| 11826 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11827 | struct snd_ctl_elem_value *ucontrol) |
| 11828 | { |
| 11829 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11830 | long *valp = ucontrol->value.integer.value; |
| 11831 | int change; |
| 11832 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11833 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11834 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11835 | if (change) |
| 11836 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11837 | return change; |
| 11838 | } |
| 11839 | |
| 11840 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11841 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11842 | { |
| 11843 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11844 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11845 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11846 | .info = snd_hda_mixer_amp_switch_info, |
| 11847 | .get = snd_hda_mixer_amp_switch_get, |
| 11848 | .put = alc262_fujitsu_master_sw_put, |
| 11849 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11850 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11851 | { |
| 11852 | .iface = NID_MAPPING, |
| 11853 | .name = "Master Playback Switch", |
| 11854 | .private_value = 0x1b, |
| 11855 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11856 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11857 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11858 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11859 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11860 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11861 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11862 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11863 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11864 | { } /* end */ |
| 11865 | }; |
| 11866 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11867 | /* bind hp and internal speaker mute (with plug check) */ |
| 11868 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11869 | struct snd_ctl_elem_value *ucontrol) |
| 11870 | { |
| 11871 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11872 | long *valp = ucontrol->value.integer.value; |
| 11873 | int change; |
| 11874 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11875 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11876 | if (change) |
| 11877 | alc262_lenovo_3000_automute(codec, 0); |
| 11878 | return change; |
| 11879 | } |
| 11880 | |
| 11881 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11882 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11883 | { |
| 11884 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11885 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11886 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11887 | .info = snd_hda_mixer_amp_switch_info, |
| 11888 | .get = snd_hda_mixer_amp_switch_get, |
| 11889 | .put = alc262_lenovo_3000_master_sw_put, |
| 11890 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11891 | }, |
| 11892 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11893 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11894 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11895 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11896 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11897 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11898 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11899 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11900 | { } /* end */ |
| 11901 | }; |
| 11902 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11903 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11904 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11905 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11906 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11907 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11908 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11909 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11910 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11911 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11912 | { } /* end */ |
| 11913 | }; |
| 11914 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11915 | /* additional init verbs for Benq laptops */ |
| 11916 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11917 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11918 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11919 | {} |
| 11920 | }; |
| 11921 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11922 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11923 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11924 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11925 | |
| 11926 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11927 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11928 | {} |
| 11929 | }; |
| 11930 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11931 | /* Samsung Q1 Ultra Vista model setup */ |
| 11932 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11933 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11934 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11935 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11936 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11937 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 11938 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11939 | { } /* end */ |
| 11940 | }; |
| 11941 | |
| 11942 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11943 | /* output mixer */ |
| 11944 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11945 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11946 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11947 | /* speaker */ |
| 11948 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11949 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11950 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11951 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11952 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11953 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11954 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11955 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11956 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11957 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11958 | /* internal mic */ |
| 11959 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11960 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11961 | /* ADC, choose mic */ |
| 11962 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11963 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11964 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11965 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11966 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11967 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11968 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11969 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11970 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11971 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11972 | {} |
| 11973 | }; |
| 11974 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11975 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11976 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11977 | { |
| 11978 | struct alc_spec *spec = codec->spec; |
| 11979 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11980 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11981 | mute = 0; |
| 11982 | /* auto-mute only when HP is used as HP */ |
| 11983 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11984 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11985 | if (spec->jack_present) |
| 11986 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11987 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11988 | /* mute/unmute internal speaker */ |
| 11989 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11990 | HDA_AMP_MUTE, mute); |
| 11991 | /* mute/unmute HP */ |
| 11992 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11993 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11994 | } |
| 11995 | |
| 11996 | /* unsolicited event for HP jack sensing */ |
| 11997 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11998 | unsigned int res) |
| 11999 | { |
| 12000 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12001 | return; |
| 12002 | alc262_ultra_automute(codec); |
| 12003 | } |
| 12004 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12005 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 12006 | .num_items = 2, |
| 12007 | .items = { |
| 12008 | { "Mic", 0x1 }, |
| 12009 | { "Headphone", 0x7 }, |
| 12010 | }, |
| 12011 | }; |
| 12012 | |
| 12013 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12014 | struct snd_ctl_elem_value *ucontrol) |
| 12015 | { |
| 12016 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12017 | struct alc_spec *spec = codec->spec; |
| 12018 | int ret; |
| 12019 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12020 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12021 | if (!ret) |
| 12022 | return 0; |
| 12023 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12024 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12025 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12026 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12027 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12028 | return ret; |
| 12029 | } |
| 12030 | |
| 12031 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12032 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12033 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12034 | { |
| 12035 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12036 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12037 | .info = alc_mux_enum_info, |
| 12038 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12039 | .put = alc262_ultra_mux_enum_put, |
| 12040 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12041 | { |
| 12042 | .iface = NID_MAPPING, |
| 12043 | .name = "Capture Source", |
| 12044 | .private_value = 0x15, |
| 12045 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12046 | { } /* end */ |
| 12047 | }; |
| 12048 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12049 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12050 | * and thus it's bound with a different mixer. |
| 12051 | * This function returns which mixer amp should be used. |
| 12052 | */ |
| 12053 | static int alc262_check_volbit(hda_nid_t nid) |
| 12054 | { |
| 12055 | if (!nid) |
| 12056 | return 0; |
| 12057 | else if (nid == 0x16) |
| 12058 | return 2; |
| 12059 | else |
| 12060 | return 1; |
| 12061 | } |
| 12062 | |
| 12063 | 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] | 12064 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12065 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12066 | unsigned long val; |
| 12067 | int vbit; |
| 12068 | |
| 12069 | vbit = alc262_check_volbit(nid); |
| 12070 | if (!vbit) |
| 12071 | return 0; |
| 12072 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12073 | return 0; |
| 12074 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12075 | if (vbit == 2) |
| 12076 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12077 | else |
| 12078 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12079 | 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] | 12080 | } |
| 12081 | |
| 12082 | 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] | 12083 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12084 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12085 | unsigned long val; |
| 12086 | |
| 12087 | if (!nid) |
| 12088 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12089 | if (nid == 0x16) |
| 12090 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12091 | else |
| 12092 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12093 | 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] | 12094 | } |
| 12095 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12096 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12097 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12098 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12099 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12100 | const char *pfx; |
| 12101 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12102 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12103 | |
| 12104 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12105 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12106 | spec->multiout.dac_nids[0] = 2; |
| 12107 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12108 | pfx = alc_get_line_out_pfx(cfg, true); |
| 12109 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12110 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12111 | for (i = 0; i < 2; i++) { |
| 12112 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12113 | if (err < 0) |
| 12114 | return err; |
| 12115 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12116 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12117 | "Speaker", i); |
| 12118 | if (err < 0) |
| 12119 | return err; |
| 12120 | } |
| 12121 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12122 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12123 | "Headphone", i); |
| 12124 | if (err < 0) |
| 12125 | return err; |
| 12126 | } |
| 12127 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12128 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12129 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12130 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12131 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12132 | if (vbits == 1 || vbits == 2) |
| 12133 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12134 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12135 | for (i = 0; i < 2; i++) { |
| 12136 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12137 | &vbits, i); |
| 12138 | if (err < 0) |
| 12139 | return err; |
| 12140 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12141 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12142 | "Speaker", &vbits, i); |
| 12143 | if (err < 0) |
| 12144 | return err; |
| 12145 | } |
| 12146 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12147 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12148 | "Headphone", &vbits, i); |
| 12149 | if (err < 0) |
| 12150 | return err; |
| 12151 | } |
| 12152 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12153 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12154 | } |
| 12155 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12156 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12157 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12158 | |
| 12159 | /* |
| 12160 | * generic initialization of ADC, input mixers and output mixers |
| 12161 | */ |
| 12162 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12163 | /* |
| 12164 | * Unmute ADC0-2 and set the default input to mic-in |
| 12165 | */ |
| 12166 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12167 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12168 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12169 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12170 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12171 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12172 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12173 | /* 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] | 12174 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12175 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12176 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12177 | */ |
| 12178 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12179 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12180 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12181 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12182 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12183 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12184 | |
| 12185 | /* |
| 12186 | * Set up output mixers (0x0c - 0x0f) |
| 12187 | */ |
| 12188 | /* set vol=0 to output mixers */ |
| 12189 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12190 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12191 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12192 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12193 | /* set up input amps for analog loopback */ |
| 12194 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12195 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12196 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12197 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12198 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12199 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12200 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12201 | |
| 12202 | /* FIXME: use matrix-type input source selection */ |
| 12203 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12204 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12205 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12206 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12207 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12208 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12209 | /* Input mixer2 */ |
| 12210 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12211 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12212 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12213 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12214 | /* Input mixer3 */ |
| 12215 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12216 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12217 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12218 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12219 | |
| 12220 | { } |
| 12221 | }; |
| 12222 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12223 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12224 | /* |
| 12225 | * Unmute ADC0-2 and set the default input to mic-in |
| 12226 | */ |
| 12227 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12228 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12229 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12230 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12231 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12232 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12233 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12234 | /* 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] | 12235 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12236 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12237 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12238 | */ |
| 12239 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12240 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12241 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12242 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12243 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12244 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12245 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12246 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12247 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12248 | /* |
| 12249 | * Set up output mixers (0x0c - 0x0e) |
| 12250 | */ |
| 12251 | /* set vol=0 to output mixers */ |
| 12252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12253 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12254 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12255 | |
| 12256 | /* set up input amps for analog loopback */ |
| 12257 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12258 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12259 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12260 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12261 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12262 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12263 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12264 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12265 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12266 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12267 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12268 | |
| 12269 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12270 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12271 | |
| 12272 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12273 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12274 | |
| 12275 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12276 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12277 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12278 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12279 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12280 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12281 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12282 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12283 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12284 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12285 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12286 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12287 | |
| 12288 | |
| 12289 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12290 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12291 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12292 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12293 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12294 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12295 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12296 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12297 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12298 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12299 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12300 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12301 | /* Input mixer2 */ |
| 12302 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12303 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12304 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12305 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12306 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12307 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12308 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12309 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12310 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12311 | /* Input mixer3 */ |
| 12312 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12313 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12314 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12315 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12316 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12317 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12318 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12319 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12320 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12321 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12322 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12323 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12324 | { } |
| 12325 | }; |
| 12326 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12327 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12328 | /* |
| 12329 | * Unmute ADC0-2 and set the default input to mic-in |
| 12330 | */ |
| 12331 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12333 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12334 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12335 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12336 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12337 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12338 | /* 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] | 12339 | * mixer widget |
| 12340 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12341 | * panel mic (mic 2) |
| 12342 | */ |
| 12343 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12344 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12345 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12346 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12347 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12348 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12349 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12350 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12351 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12352 | /* |
| 12353 | * Set up output mixers (0x0c - 0x0e) |
| 12354 | */ |
| 12355 | /* set vol=0 to output mixers */ |
| 12356 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12357 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12358 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12359 | |
| 12360 | /* set up input amps for analog loopback */ |
| 12361 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12364 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12365 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12366 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12367 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12368 | |
| 12369 | |
| 12370 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12371 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12372 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12373 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12374 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12375 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12376 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12377 | |
| 12378 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12379 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12380 | |
| 12381 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12382 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12383 | |
| 12384 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12385 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12386 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12387 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12388 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12389 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12390 | |
| 12391 | /* FIXME: use matrix-type input source selection */ |
| 12392 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12393 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12394 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12395 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12396 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12397 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12398 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12399 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12400 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12401 | /* Input mixer2 */ |
| 12402 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12403 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12404 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12405 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12406 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12407 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12408 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12409 | /* Input mixer3 */ |
| 12410 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12411 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12412 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12413 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12414 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12415 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12416 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12417 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12418 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12419 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12420 | { } |
| 12421 | }; |
| 12422 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12423 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12424 | |
| 12425 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12426 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12427 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12428 | |
| 12429 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12430 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12431 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12432 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12433 | |
| 12434 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12435 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12436 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12437 | {} |
| 12438 | }; |
| 12439 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12440 | /* |
| 12441 | * Pin config fixes |
| 12442 | */ |
| 12443 | enum { |
| 12444 | PINFIX_FSC_H270, |
| 12445 | }; |
| 12446 | |
| 12447 | static const struct alc_fixup alc262_fixups[] = { |
| 12448 | [PINFIX_FSC_H270] = { |
| 12449 | .pins = (const struct alc_pincfg[]) { |
| 12450 | { 0x14, 0x99130110 }, /* speaker */ |
| 12451 | { 0x15, 0x0221142f }, /* front HP */ |
| 12452 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12453 | { } |
| 12454 | } |
| 12455 | }, |
| 12456 | [PINFIX_PB_M5210] = { |
| 12457 | .verbs = (const struct hda_verb[]) { |
| 12458 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 12459 | {} |
| 12460 | } |
| 12461 | }, |
| 12462 | }; |
| 12463 | |
| 12464 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12465 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12466 | {} |
| 12467 | }; |
| 12468 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12469 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12470 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12471 | #define alc262_loopbacks alc880_loopbacks |
| 12472 | #endif |
| 12473 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12474 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12475 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12476 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12477 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12478 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12479 | |
| 12480 | /* |
| 12481 | * BIOS auto configuration |
| 12482 | */ |
| 12483 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12484 | { |
| 12485 | struct alc_spec *spec = codec->spec; |
| 12486 | int err; |
| 12487 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12488 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12489 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12490 | alc262_ignore); |
| 12491 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12492 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12493 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12494 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12495 | spec->multiout.max_channels = 2; |
| 12496 | spec->no_analog = 1; |
| 12497 | goto dig_only; |
| 12498 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12499 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12500 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12501 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12502 | if (err < 0) |
| 12503 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12504 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12505 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12506 | return err; |
| 12507 | |
| 12508 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12509 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12510 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12511 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12512 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12513 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12514 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12515 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12516 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12517 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12518 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12519 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12520 | err = alc_auto_add_mic_boost(codec); |
| 12521 | if (err < 0) |
| 12522 | return err; |
| 12523 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12524 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12525 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12526 | return 1; |
| 12527 | } |
| 12528 | |
| 12529 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12530 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12531 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12532 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12533 | |
| 12534 | |
| 12535 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12536 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12537 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12538 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12539 | alc262_auto_init_multi_out(codec); |
| 12540 | alc262_auto_init_hp_out(codec); |
| 12541 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12542 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12543 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12544 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12545 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12546 | } |
| 12547 | |
| 12548 | /* |
| 12549 | * configuration and preset |
| 12550 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12551 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12552 | [ALC262_BASIC] = "basic", |
| 12553 | [ALC262_HIPPO] = "hippo", |
| 12554 | [ALC262_HIPPO_1] = "hippo_1", |
| 12555 | [ALC262_FUJITSU] = "fujitsu", |
| 12556 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12557 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12558 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12559 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12560 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12561 | [ALC262_BENQ_T31] = "benq-t31", |
| 12562 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12563 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12564 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12565 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12566 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12567 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12568 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12569 | [ALC262_AUTO] = "auto", |
| 12570 | }; |
| 12571 | |
| 12572 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12573 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12574 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12575 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12576 | ALC262_HP_BPC), |
| 12577 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12578 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12579 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12580 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12581 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12582 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12583 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12584 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12585 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12586 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12587 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12588 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12589 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12590 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12591 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12592 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12593 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12594 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12595 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12596 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12597 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12598 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12599 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12600 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12601 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12602 | #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] | 12603 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12604 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12605 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12606 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12607 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12608 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12609 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12610 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12611 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12612 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12613 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12614 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12615 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12616 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12617 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12618 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12619 | {} |
| 12620 | }; |
| 12621 | |
| 12622 | static struct alc_config_preset alc262_presets[] = { |
| 12623 | [ALC262_BASIC] = { |
| 12624 | .mixers = { alc262_base_mixer }, |
| 12625 | .init_verbs = { alc262_init_verbs }, |
| 12626 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12627 | .dac_nids = alc262_dac_nids, |
| 12628 | .hp_nid = 0x03, |
| 12629 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12630 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12631 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12632 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12633 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12634 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12635 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12636 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12637 | .dac_nids = alc262_dac_nids, |
| 12638 | .hp_nid = 0x03, |
| 12639 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12640 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12641 | .channel_mode = alc262_modes, |
| 12642 | .input_mux = &alc262_capture_source, |
| 12643 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12644 | .setup = alc262_hippo_setup, |
| 12645 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12646 | }, |
| 12647 | [ALC262_HIPPO_1] = { |
| 12648 | .mixers = { alc262_hippo1_mixer }, |
| 12649 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12650 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12651 | .dac_nids = alc262_dac_nids, |
| 12652 | .hp_nid = 0x02, |
| 12653 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12654 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12655 | .channel_mode = alc262_modes, |
| 12656 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12657 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12658 | .setup = alc262_hippo1_setup, |
| 12659 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12660 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12661 | [ALC262_FUJITSU] = { |
| 12662 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12663 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12664 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12665 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12666 | .dac_nids = alc262_dac_nids, |
| 12667 | .hp_nid = 0x03, |
| 12668 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12669 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12670 | .channel_mode = alc262_modes, |
| 12671 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12672 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12673 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12674 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12675 | [ALC262_HP_BPC] = { |
| 12676 | .mixers = { alc262_HP_BPC_mixer }, |
| 12677 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12678 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12679 | .dac_nids = alc262_dac_nids, |
| 12680 | .hp_nid = 0x03, |
| 12681 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12682 | .channel_mode = alc262_modes, |
| 12683 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12684 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12685 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12686 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12687 | [ALC262_HP_BPC_D7000_WF] = { |
| 12688 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12689 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12690 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12691 | .dac_nids = alc262_dac_nids, |
| 12692 | .hp_nid = 0x03, |
| 12693 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12694 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12695 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12696 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12697 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12698 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12699 | [ALC262_HP_BPC_D7000_WL] = { |
| 12700 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12701 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12702 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12703 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12704 | .dac_nids = alc262_dac_nids, |
| 12705 | .hp_nid = 0x03, |
| 12706 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12707 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12708 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12709 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12710 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12711 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12712 | [ALC262_HP_TC_T5735] = { |
| 12713 | .mixers = { alc262_hp_t5735_mixer }, |
| 12714 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12715 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12716 | .dac_nids = alc262_dac_nids, |
| 12717 | .hp_nid = 0x03, |
| 12718 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12719 | .channel_mode = alc262_modes, |
| 12720 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12721 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12722 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12723 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12724 | }, |
| 12725 | [ALC262_HP_RP5700] = { |
| 12726 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12727 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12728 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12729 | .dac_nids = alc262_dac_nids, |
| 12730 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12731 | .channel_mode = alc262_modes, |
| 12732 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12733 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12734 | [ALC262_BENQ_ED8] = { |
| 12735 | .mixers = { alc262_base_mixer }, |
| 12736 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12737 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12738 | .dac_nids = alc262_dac_nids, |
| 12739 | .hp_nid = 0x03, |
| 12740 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12741 | .channel_mode = alc262_modes, |
| 12742 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12743 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12744 | [ALC262_SONY_ASSAMD] = { |
| 12745 | .mixers = { alc262_sony_mixer }, |
| 12746 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12747 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12748 | .dac_nids = alc262_dac_nids, |
| 12749 | .hp_nid = 0x02, |
| 12750 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12751 | .channel_mode = alc262_modes, |
| 12752 | .input_mux = &alc262_capture_source, |
| 12753 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12754 | .setup = alc262_hippo_setup, |
| 12755 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12756 | }, |
| 12757 | [ALC262_BENQ_T31] = { |
| 12758 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12759 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12760 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12761 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12762 | .dac_nids = alc262_dac_nids, |
| 12763 | .hp_nid = 0x03, |
| 12764 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12765 | .channel_mode = alc262_modes, |
| 12766 | .input_mux = &alc262_capture_source, |
| 12767 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12768 | .setup = alc262_hippo_setup, |
| 12769 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12770 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12771 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12772 | .mixers = { alc262_ultra_mixer }, |
| 12773 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12774 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12775 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12776 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12777 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12778 | .channel_mode = alc262_modes, |
| 12779 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12780 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12781 | .capsrc_nids = alc262_capsrc_nids, |
| 12782 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12783 | .unsol_event = alc262_ultra_unsol_event, |
| 12784 | .init_hook = alc262_ultra_automute, |
| 12785 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12786 | [ALC262_LENOVO_3000] = { |
| 12787 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12788 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12789 | alc262_lenovo_3000_unsol_verbs, |
| 12790 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12791 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12792 | .dac_nids = alc262_dac_nids, |
| 12793 | .hp_nid = 0x03, |
| 12794 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12795 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12796 | .channel_mode = alc262_modes, |
| 12797 | .input_mux = &alc262_fujitsu_capture_source, |
| 12798 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12799 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12800 | [ALC262_NEC] = { |
| 12801 | .mixers = { alc262_nec_mixer }, |
| 12802 | .init_verbs = { alc262_nec_verbs }, |
| 12803 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12804 | .dac_nids = alc262_dac_nids, |
| 12805 | .hp_nid = 0x03, |
| 12806 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12807 | .channel_mode = alc262_modes, |
| 12808 | .input_mux = &alc262_capture_source, |
| 12809 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12810 | [ALC262_TOSHIBA_S06] = { |
| 12811 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12812 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12813 | alc262_eapd_verbs }, |
| 12814 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12815 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12816 | .dac_nids = alc262_dac_nids, |
| 12817 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12818 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12819 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12820 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12821 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12822 | .unsol_event = alc_sku_unsol_event, |
| 12823 | .setup = alc262_toshiba_s06_setup, |
| 12824 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12825 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12826 | [ALC262_TOSHIBA_RX1] = { |
| 12827 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12828 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12829 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12830 | .dac_nids = alc262_dac_nids, |
| 12831 | .hp_nid = 0x03, |
| 12832 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12833 | .channel_mode = alc262_modes, |
| 12834 | .input_mux = &alc262_capture_source, |
| 12835 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12836 | .setup = alc262_hippo_setup, |
| 12837 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12838 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12839 | [ALC262_TYAN] = { |
| 12840 | .mixers = { alc262_tyan_mixer }, |
| 12841 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12842 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12843 | .dac_nids = alc262_dac_nids, |
| 12844 | .hp_nid = 0x02, |
| 12845 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12846 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12847 | .channel_mode = alc262_modes, |
| 12848 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12849 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12850 | .setup = alc262_tyan_setup, |
| 12851 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12852 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12853 | }; |
| 12854 | |
| 12855 | static int patch_alc262(struct hda_codec *codec) |
| 12856 | { |
| 12857 | struct alc_spec *spec; |
| 12858 | int board_config; |
| 12859 | int err; |
| 12860 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12861 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12862 | if (spec == NULL) |
| 12863 | return -ENOMEM; |
| 12864 | |
| 12865 | codec->spec = spec; |
| 12866 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12867 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12868 | * under-run |
| 12869 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12870 | { |
| 12871 | int tmp; |
| 12872 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12873 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12874 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12875 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12876 | } |
| 12877 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12878 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12879 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12880 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12881 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12882 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12883 | alc262_models, |
| 12884 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12885 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12886 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12887 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12888 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12889 | board_config = ALC262_AUTO; |
| 12890 | } |
| 12891 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12892 | if (board_config == ALC262_AUTO) |
| 12893 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); |
| 12894 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12895 | if (board_config == ALC262_AUTO) { |
| 12896 | /* automatic parse from the BIOS config */ |
| 12897 | err = alc262_parse_auto_config(codec); |
| 12898 | if (err < 0) { |
| 12899 | alc_free(codec); |
| 12900 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12901 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12902 | printk(KERN_INFO |
| 12903 | "hda_codec: Cannot set up configuration " |
| 12904 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12905 | board_config = ALC262_BASIC; |
| 12906 | } |
| 12907 | } |
| 12908 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12909 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12910 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12911 | if (err < 0) { |
| 12912 | alc_free(codec); |
| 12913 | return err; |
| 12914 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12915 | } |
| 12916 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12917 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12918 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12919 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12920 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12921 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12922 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12923 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12924 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12925 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12926 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12927 | int i; |
| 12928 | /* check whether the digital-mic has to be supported */ |
| 12929 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12930 | if (spec->input_mux->items[i].index >= 9) |
| 12931 | break; |
| 12932 | } |
| 12933 | if (i < spec->input_mux->num_items) { |
| 12934 | /* use only ADC0 */ |
| 12935 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12936 | spec->num_adc_nids = 1; |
| 12937 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12938 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12939 | /* all analog inputs */ |
| 12940 | /* check whether NID 0x07 is valid */ |
| 12941 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12942 | |
| 12943 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12944 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12945 | if (wcap != AC_WID_AUD_IN) { |
| 12946 | spec->adc_nids = alc262_adc_nids_alt; |
| 12947 | spec->num_adc_nids = |
| 12948 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12949 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12950 | } else { |
| 12951 | spec->adc_nids = alc262_adc_nids; |
| 12952 | spec->num_adc_nids = |
| 12953 | ARRAY_SIZE(alc262_adc_nids); |
| 12954 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12955 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12956 | } |
| 12957 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12958 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12959 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12960 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12961 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12962 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12963 | if (board_config == ALC262_AUTO) |
| 12964 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0); |
| 12965 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12966 | spec->vmaster_nid = 0x0c; |
| 12967 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12968 | codec->patch_ops = alc_patch_ops; |
| 12969 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12970 | spec->init_hook = alc262_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 12971 | |
| 12972 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12973 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12974 | if (!spec->loopback.amplist) |
| 12975 | spec->loopback.amplist = alc262_loopbacks; |
| 12976 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12977 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12978 | return 0; |
| 12979 | } |
| 12980 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12981 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12982 | * ALC268 channel source setting (2 channel) |
| 12983 | */ |
| 12984 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12985 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12986 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12987 | static hda_nid_t alc268_dac_nids[2] = { |
| 12988 | /* front, hp */ |
| 12989 | 0x02, 0x03 |
| 12990 | }; |
| 12991 | |
| 12992 | static hda_nid_t alc268_adc_nids[2] = { |
| 12993 | /* ADC0-1 */ |
| 12994 | 0x08, 0x07 |
| 12995 | }; |
| 12996 | |
| 12997 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12998 | /* ADC0 */ |
| 12999 | 0x08 |
| 13000 | }; |
| 13001 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13002 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 13003 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13004 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 13005 | /* output mixer control */ |
| 13006 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13007 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13008 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13010 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13011 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13012 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13013 | { } |
| 13014 | }; |
| 13015 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13016 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 13017 | /* output mixer control */ |
| 13018 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13019 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13020 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13021 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13022 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13023 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13024 | { } |
| 13025 | }; |
| 13026 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13027 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13028 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13029 | .ops = &snd_hda_bind_sw, |
| 13030 | .values = { |
| 13031 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13032 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13033 | 0 |
| 13034 | }, |
| 13035 | }; |
| 13036 | |
| 13037 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13038 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13039 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13040 | { } |
| 13041 | }; |
| 13042 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13043 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13044 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13045 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13046 | { } |
| 13047 | }; |
| 13048 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13049 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13050 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13051 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13052 | { } /* end */ |
| 13053 | }; |
| 13054 | |
| 13055 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13056 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13057 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13058 | .ops = &snd_hda_bind_vol, |
| 13059 | .values = { |
| 13060 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13061 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13062 | 0 |
| 13063 | }, |
| 13064 | }; |
| 13065 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13066 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 13067 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 13068 | { |
| 13069 | struct alc_spec *spec = codec->spec; |
| 13070 | unsigned int mute; |
| 13071 | |
| 13072 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13073 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13074 | spec->sense_updated = 1; |
| 13075 | } |
| 13076 | if (spec->jack_present) |
| 13077 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 13078 | else /* unmute internal speaker if necessary */ |
| 13079 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13080 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13081 | HDA_AMP_MUTE, mute); |
| 13082 | } |
| 13083 | |
| 13084 | |
| 13085 | /* bind hp and internal speaker mute (with plug check) */ |
| 13086 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 13087 | struct snd_ctl_elem_value *ucontrol) |
| 13088 | { |
| 13089 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 13090 | long *valp = ucontrol->value.integer.value; |
| 13091 | int change; |
| 13092 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 13093 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13094 | if (change) |
| 13095 | alc268_acer_automute(codec, 0); |
| 13096 | return change; |
| 13097 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13098 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13099 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13100 | /* output mixer control */ |
| 13101 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13102 | { |
| 13103 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13104 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13105 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13106 | .info = snd_hda_mixer_amp_switch_info, |
| 13107 | .get = snd_hda_mixer_amp_switch_get, |
| 13108 | .put = alc268_acer_master_sw_put, |
| 13109 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13110 | }, |
| 13111 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13112 | { } |
| 13113 | }; |
| 13114 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13115 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13116 | /* output mixer control */ |
| 13117 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13118 | { |
| 13119 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13120 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13121 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13122 | .info = snd_hda_mixer_amp_switch_info, |
| 13123 | .get = snd_hda_mixer_amp_switch_get, |
| 13124 | .put = alc268_acer_master_sw_put, |
| 13125 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13126 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13127 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13128 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13129 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13130 | { } |
| 13131 | }; |
| 13132 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13133 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13134 | /* output mixer control */ |
| 13135 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13136 | { |
| 13137 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13138 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13139 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13140 | .info = snd_hda_mixer_amp_switch_info, |
| 13141 | .get = snd_hda_mixer_amp_switch_get, |
| 13142 | .put = alc268_acer_master_sw_put, |
| 13143 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13144 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13145 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13146 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13147 | { } |
| 13148 | }; |
| 13149 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13150 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13151 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13152 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13153 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13154 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13155 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13156 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13157 | { } |
| 13158 | }; |
| 13159 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13160 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13161 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13162 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13163 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13164 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13165 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13166 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13167 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13168 | { } |
| 13169 | }; |
| 13170 | |
| 13171 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13172 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13173 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13174 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13175 | |
| 13176 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13177 | unsigned int res) |
| 13178 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13179 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13180 | return; |
| 13181 | alc268_acer_automute(codec, 1); |
| 13182 | } |
| 13183 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13184 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13185 | { |
| 13186 | alc268_acer_automute(codec, 1); |
| 13187 | } |
| 13188 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13189 | /* toggle speaker-output according to the hp-jack state */ |
| 13190 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13191 | { |
| 13192 | unsigned int present; |
| 13193 | unsigned char bits; |
| 13194 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13195 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13196 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13197 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13198 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13199 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13200 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13201 | } |
| 13202 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13203 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13204 | unsigned int res) |
| 13205 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13206 | switch (res >> 26) { |
| 13207 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13208 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13209 | break; |
| 13210 | case ALC880_MIC_EVENT: |
| 13211 | alc_mic_automute(codec); |
| 13212 | break; |
| 13213 | } |
| 13214 | } |
| 13215 | |
| 13216 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13217 | { |
| 13218 | struct alc_spec *spec = codec->spec; |
| 13219 | spec->ext_mic.pin = 0x18; |
| 13220 | spec->ext_mic.mux_idx = 0; |
| 13221 | spec->int_mic.pin = 0x12; |
| 13222 | spec->int_mic.mux_idx = 6; |
| 13223 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13224 | } |
| 13225 | |
| 13226 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13227 | { |
| 13228 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13229 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13230 | } |
| 13231 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13232 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13233 | /* output mixer control */ |
| 13234 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13235 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13236 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13237 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13238 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13239 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13240 | { } |
| 13241 | }; |
| 13242 | |
| 13243 | static struct hda_verb alc268_dell_verbs[] = { |
| 13244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13245 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13246 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13247 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13248 | { } |
| 13249 | }; |
| 13250 | |
| 13251 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13252 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13253 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13254 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13255 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13256 | spec->autocfg.hp_pins[0] = 0x15; |
| 13257 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13258 | spec->ext_mic.pin = 0x18; |
| 13259 | spec->ext_mic.mux_idx = 0; |
| 13260 | spec->int_mic.pin = 0x19; |
| 13261 | spec->int_mic.mux_idx = 1; |
| 13262 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13263 | } |
| 13264 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13265 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13266 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13267 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13268 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13269 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13270 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13271 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13272 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13273 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13274 | { } |
| 13275 | }; |
| 13276 | |
| 13277 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13278 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13279 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13280 | { } |
| 13281 | }; |
| 13282 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13283 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13284 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13285 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13286 | spec->autocfg.hp_pins[0] = 0x15; |
| 13287 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13288 | spec->ext_mic.pin = 0x18; |
| 13289 | spec->ext_mic.mux_idx = 0; |
| 13290 | spec->int_mic.pin = 0x19; |
| 13291 | spec->int_mic.mux_idx = 1; |
| 13292 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13293 | } |
| 13294 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13295 | /* |
| 13296 | * generic initialization of ADC, input mixers and output mixers |
| 13297 | */ |
| 13298 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13299 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13300 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13301 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13302 | |
| 13303 | /* |
| 13304 | * Set up output mixers (0x0c - 0x0e) |
| 13305 | */ |
| 13306 | /* set vol=0 to output mixers */ |
| 13307 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13308 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13309 | |
| 13310 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13311 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13312 | |
| 13313 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13314 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13315 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13316 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13317 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13318 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13319 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13320 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13321 | |
| 13322 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13323 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13324 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13325 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13326 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13327 | |
| 13328 | /* set PCBEEP vol = 0, mute connections */ |
| 13329 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13330 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13331 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13332 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13333 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13334 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13335 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13336 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13337 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13338 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13339 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13340 | { } |
| 13341 | }; |
| 13342 | |
| 13343 | /* |
| 13344 | * generic initialization of ADC, input mixers and output mixers |
| 13345 | */ |
| 13346 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13347 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13348 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13349 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13350 | |
| 13351 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13352 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13353 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13354 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13355 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13356 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13357 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13358 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13359 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13360 | |
| 13361 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13362 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13363 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13364 | /* set PCBEEP vol = 0, mute connections */ |
| 13365 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13366 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13367 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13368 | |
| 13369 | { } |
| 13370 | }; |
| 13371 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13372 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13373 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13374 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13375 | { } /* end */ |
| 13376 | }; |
| 13377 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13378 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13379 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13380 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13381 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13382 | { } /* end */ |
| 13383 | }; |
| 13384 | |
| 13385 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13386 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13387 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13388 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13389 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13390 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13391 | { } /* end */ |
| 13392 | }; |
| 13393 | |
| 13394 | static struct hda_input_mux alc268_capture_source = { |
| 13395 | .num_items = 4, |
| 13396 | .items = { |
| 13397 | { "Mic", 0x0 }, |
| 13398 | { "Front Mic", 0x1 }, |
| 13399 | { "Line", 0x2 }, |
| 13400 | { "CD", 0x3 }, |
| 13401 | }, |
| 13402 | }; |
| 13403 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13404 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13405 | .num_items = 3, |
| 13406 | .items = { |
| 13407 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13408 | { "Internal Mic", 0x1 }, |
| 13409 | { "Line", 0x2 }, |
| 13410 | }, |
| 13411 | }; |
| 13412 | |
| 13413 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13414 | .num_items = 3, |
| 13415 | .items = { |
| 13416 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13417 | { "Internal Mic", 0x6 }, |
| 13418 | { "Line", 0x2 }, |
| 13419 | }, |
| 13420 | }; |
| 13421 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13422 | #ifdef CONFIG_SND_DEBUG |
| 13423 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13424 | /* Volume widgets */ |
| 13425 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13426 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13427 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13428 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13429 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13430 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13431 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13432 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13433 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13434 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13435 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13436 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13437 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13438 | /* The below appears problematic on some hardwares */ |
| 13439 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13440 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13441 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13442 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13443 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13444 | |
| 13445 | /* Modes for retasking pin widgets */ |
| 13446 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13447 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13448 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13449 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13450 | |
| 13451 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13452 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13453 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13454 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13455 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13456 | |
| 13457 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13458 | * The ALC268 does not have an SPDIF input. |
| 13459 | */ |
| 13460 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13461 | |
| 13462 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13463 | * this output to turn on an external amplifier. |
| 13464 | */ |
| 13465 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13466 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13467 | |
| 13468 | { } /* end */ |
| 13469 | }; |
| 13470 | #endif |
| 13471 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13472 | /* create input playback/capture controls for the given pin */ |
| 13473 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13474 | const char *ctlname, int idx) |
| 13475 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13476 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13477 | int err; |
| 13478 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13479 | switch (nid) { |
| 13480 | case 0x14: |
| 13481 | case 0x16: |
| 13482 | dac = 0x02; |
| 13483 | break; |
| 13484 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13485 | case 0x1a: /* ALC259/269 only */ |
| 13486 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13487 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13488 | dac = 0x03; |
| 13489 | break; |
| 13490 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13491 | snd_printd(KERN_WARNING "hda_codec: " |
| 13492 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13493 | return 0; |
| 13494 | } |
| 13495 | if (spec->multiout.dac_nids[0] != dac && |
| 13496 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13497 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13498 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13499 | HDA_OUTPUT)); |
| 13500 | if (err < 0) |
| 13501 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13502 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13503 | } |
| 13504 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13505 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13506 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13507 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13508 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13509 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13510 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13511 | if (err < 0) |
| 13512 | return err; |
| 13513 | return 0; |
| 13514 | } |
| 13515 | |
| 13516 | /* add playback controls from the parsed DAC table */ |
| 13517 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13518 | const struct auto_pin_cfg *cfg) |
| 13519 | { |
| 13520 | hda_nid_t nid; |
| 13521 | int err; |
| 13522 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13523 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13524 | |
| 13525 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13526 | if (nid) { |
| 13527 | const char *name; |
| 13528 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13529 | name = "Speaker"; |
| 13530 | else |
| 13531 | name = "Front"; |
| 13532 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13533 | if (err < 0) |
| 13534 | return err; |
| 13535 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13536 | |
| 13537 | nid = cfg->speaker_pins[0]; |
| 13538 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13539 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13540 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13541 | if (err < 0) |
| 13542 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13543 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13544 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13545 | if (err < 0) |
| 13546 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13547 | } |
| 13548 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13549 | if (nid) { |
| 13550 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13551 | if (err < 0) |
| 13552 | return err; |
| 13553 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13554 | |
| 13555 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 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, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13558 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13559 | if (err < 0) |
| 13560 | return err; |
| 13561 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13562 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13563 | } |
| 13564 | |
| 13565 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13566 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13567 | const struct auto_pin_cfg *cfg) |
| 13568 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13569 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13570 | } |
| 13571 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13572 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13573 | hda_nid_t nid, int pin_type) |
| 13574 | { |
| 13575 | int idx; |
| 13576 | |
| 13577 | alc_set_pin_output(codec, nid, pin_type); |
| 13578 | if (nid == 0x14 || nid == 0x16) |
| 13579 | idx = 0; |
| 13580 | else |
| 13581 | idx = 1; |
| 13582 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13583 | } |
| 13584 | |
| 13585 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13586 | { |
| 13587 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13588 | int i; |
| 13589 | |
| 13590 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13591 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13592 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13593 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13594 | } |
| 13595 | } |
| 13596 | |
| 13597 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13598 | { |
| 13599 | struct alc_spec *spec = codec->spec; |
| 13600 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13601 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13602 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13603 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13604 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13605 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13606 | } |
| 13607 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13608 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13609 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13610 | } |
| 13611 | if (spec->autocfg.mono_out_pin) |
| 13612 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13613 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13614 | } |
| 13615 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13616 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13617 | { |
| 13618 | struct alc_spec *spec = codec->spec; |
| 13619 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13620 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13621 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13622 | unsigned int dac_vol1, dac_vol2; |
| 13623 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13624 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13625 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13626 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13627 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13628 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13629 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13630 | AMP_IN_UNMUTE(1)); |
| 13631 | snd_hda_codec_write(codec, 0x10, 0, |
| 13632 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13633 | AMP_IN_UNMUTE(1)); |
| 13634 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13635 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13636 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13637 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13638 | snd_hda_codec_write(codec, 0x10, 0, |
| 13639 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13640 | } |
| 13641 | |
| 13642 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13643 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13644 | dac_vol2 = AMP_OUT_ZERO; |
| 13645 | else if (line_nid == 0x15) |
| 13646 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13647 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13648 | dac_vol2 = AMP_OUT_ZERO; |
| 13649 | else if (hp_nid == 0x15) |
| 13650 | dac_vol1 = AMP_OUT_ZERO; |
| 13651 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13652 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13653 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13654 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13655 | |
| 13656 | snd_hda_codec_write(codec, 0x02, 0, |
| 13657 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13658 | snd_hda_codec_write(codec, 0x03, 0, |
| 13659 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13660 | } |
| 13661 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13662 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13663 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13664 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13665 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13666 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13667 | |
| 13668 | /* |
| 13669 | * BIOS auto configuration |
| 13670 | */ |
| 13671 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13672 | { |
| 13673 | struct alc_spec *spec = codec->spec; |
| 13674 | int err; |
| 13675 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13676 | |
| 13677 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13678 | alc268_ignore); |
| 13679 | if (err < 0) |
| 13680 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13681 | if (!spec->autocfg.line_outs) { |
| 13682 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13683 | spec->multiout.max_channels = 2; |
| 13684 | spec->no_analog = 1; |
| 13685 | goto dig_only; |
| 13686 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13687 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13688 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13689 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13690 | if (err < 0) |
| 13691 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13692 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13693 | if (err < 0) |
| 13694 | return err; |
| 13695 | |
| 13696 | spec->multiout.max_channels = 2; |
| 13697 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13698 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13699 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13700 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13701 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13702 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13703 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13704 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13705 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13706 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13707 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13708 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13709 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13710 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13711 | err = alc_auto_add_mic_boost(codec); |
| 13712 | if (err < 0) |
| 13713 | return err; |
| 13714 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13715 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13716 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13717 | return 1; |
| 13718 | } |
| 13719 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13720 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13721 | |
| 13722 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13723 | static void alc268_auto_init(struct hda_codec *codec) |
| 13724 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13725 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13726 | alc268_auto_init_multi_out(codec); |
| 13727 | alc268_auto_init_hp_out(codec); |
| 13728 | alc268_auto_init_mono_speaker_out(codec); |
| 13729 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13730 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13731 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13732 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13733 | } |
| 13734 | |
| 13735 | /* |
| 13736 | * configuration and preset |
| 13737 | */ |
| 13738 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13739 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13740 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13741 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13742 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13743 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13744 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13745 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13746 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13747 | #ifdef CONFIG_SND_DEBUG |
| 13748 | [ALC268_TEST] = "test", |
| 13749 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13750 | [ALC268_AUTO] = "auto", |
| 13751 | }; |
| 13752 | |
| 13753 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13754 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13755 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13756 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13757 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13758 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13759 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13760 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13761 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13762 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13763 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13764 | /* almost compatible with toshiba but with optional digital outs; |
| 13765 | * auto-probing seems working fine |
| 13766 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13767 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13768 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13769 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13770 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13771 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13772 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13773 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13774 | {} |
| 13775 | }; |
| 13776 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13777 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13778 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13779 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13780 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13781 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13782 | ALC268_TOSHIBA), |
| 13783 | {} |
| 13784 | }; |
| 13785 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13786 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13787 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13788 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13789 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13790 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13791 | alc267_quanta_il1_verbs }, |
| 13792 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13793 | .dac_nids = alc268_dac_nids, |
| 13794 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13795 | .adc_nids = alc268_adc_nids_alt, |
| 13796 | .hp_nid = 0x03, |
| 13797 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13798 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13799 | .unsol_event = alc_sku_unsol_event, |
| 13800 | .setup = alc267_quanta_il1_setup, |
| 13801 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13802 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13803 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13804 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13805 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13806 | .init_verbs = { alc268_base_init_verbs }, |
| 13807 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13808 | .dac_nids = alc268_dac_nids, |
| 13809 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13810 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13811 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13812 | .hp_nid = 0x03, |
| 13813 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13814 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13815 | .channel_mode = alc268_modes, |
| 13816 | .input_mux = &alc268_capture_source, |
| 13817 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13818 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13819 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13820 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13821 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13822 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13823 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13824 | .dac_nids = alc268_dac_nids, |
| 13825 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13826 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13827 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13828 | .hp_nid = 0x03, |
| 13829 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13830 | .channel_mode = alc268_modes, |
| 13831 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13832 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13833 | .setup = alc268_toshiba_setup, |
| 13834 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13835 | }, |
| 13836 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13837 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13838 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13839 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13840 | alc268_acer_verbs }, |
| 13841 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13842 | .dac_nids = alc268_dac_nids, |
| 13843 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13844 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13845 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13846 | .hp_nid = 0x02, |
| 13847 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13848 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13849 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13850 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13851 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13852 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13853 | [ALC268_ACER_DMIC] = { |
| 13854 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13855 | alc268_beep_mixer }, |
| 13856 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13857 | alc268_acer_verbs }, |
| 13858 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13859 | .dac_nids = alc268_dac_nids, |
| 13860 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13861 | .adc_nids = alc268_adc_nids_alt, |
| 13862 | .capsrc_nids = alc268_capsrc_nids, |
| 13863 | .hp_nid = 0x02, |
| 13864 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13865 | .channel_mode = alc268_modes, |
| 13866 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13867 | .unsol_event = alc268_acer_unsol_event, |
| 13868 | .init_hook = alc268_acer_init_hook, |
| 13869 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13870 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13871 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13872 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13873 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13874 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13875 | alc268_acer_aspire_one_verbs }, |
| 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, |
| 13880 | .capsrc_nids = alc268_capsrc_nids, |
| 13881 | .hp_nid = 0x03, |
| 13882 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13883 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13884 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13885 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13886 | .init_hook = alc268_acer_lc_init_hook, |
| 13887 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13888 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13889 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13890 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13891 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13892 | alc268_dell_verbs }, |
| 13893 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13894 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13895 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13896 | .adc_nids = alc268_adc_nids_alt, |
| 13897 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13898 | .hp_nid = 0x02, |
| 13899 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13900 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13901 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13902 | .setup = alc268_dell_setup, |
| 13903 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13904 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13905 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13906 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13907 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13908 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13909 | alc268_toshiba_verbs }, |
| 13910 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13911 | .dac_nids = alc268_dac_nids, |
| 13912 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13913 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13914 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13915 | .hp_nid = 0x03, |
| 13916 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13917 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13918 | .channel_mode = alc268_modes, |
| 13919 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13920 | .setup = alc268_toshiba_setup, |
| 13921 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13922 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13923 | #ifdef CONFIG_SND_DEBUG |
| 13924 | [ALC268_TEST] = { |
| 13925 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13926 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13927 | alc268_volume_init_verbs }, |
| 13928 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13929 | .dac_nids = alc268_dac_nids, |
| 13930 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13931 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13932 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13933 | .hp_nid = 0x03, |
| 13934 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13935 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13936 | .channel_mode = alc268_modes, |
| 13937 | .input_mux = &alc268_capture_source, |
| 13938 | }, |
| 13939 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13940 | }; |
| 13941 | |
| 13942 | static int patch_alc268(struct hda_codec *codec) |
| 13943 | { |
| 13944 | struct alc_spec *spec; |
| 13945 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13946 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13947 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13948 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13949 | if (spec == NULL) |
| 13950 | return -ENOMEM; |
| 13951 | |
| 13952 | codec->spec = spec; |
| 13953 | |
| 13954 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13955 | alc268_models, |
| 13956 | alc268_cfg_tbl); |
| 13957 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13958 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13959 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13960 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13961 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13962 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13963 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13964 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13965 | board_config = ALC268_AUTO; |
| 13966 | } |
| 13967 | |
| 13968 | if (board_config == ALC268_AUTO) { |
| 13969 | /* automatic parse from the BIOS config */ |
| 13970 | err = alc268_parse_auto_config(codec); |
| 13971 | if (err < 0) { |
| 13972 | alc_free(codec); |
| 13973 | return err; |
| 13974 | } else if (!err) { |
| 13975 | printk(KERN_INFO |
| 13976 | "hda_codec: Cannot set up configuration " |
| 13977 | "from BIOS. Using base mode...\n"); |
| 13978 | board_config = ALC268_3ST; |
| 13979 | } |
| 13980 | } |
| 13981 | |
| 13982 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13983 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13984 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13985 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13986 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13987 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13988 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13989 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13990 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13991 | has_beep = 0; |
| 13992 | for (i = 0; i < spec->num_mixers; i++) { |
| 13993 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13994 | has_beep = 1; |
| 13995 | break; |
| 13996 | } |
| 13997 | } |
| 13998 | |
| 13999 | if (has_beep) { |
| 14000 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14001 | if (err < 0) { |
| 14002 | alc_free(codec); |
| 14003 | return err; |
| 14004 | } |
| 14005 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14006 | /* override the amp caps for beep generator */ |
| 14007 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14008 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14009 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14010 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14011 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14012 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14013 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14014 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14015 | /* check whether NID 0x07 is valid */ |
| 14016 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14017 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14018 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14019 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14020 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14021 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14022 | if (spec->auto_mic || |
| 14023 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14024 | spec->adc_nids = alc268_adc_nids_alt; |
| 14025 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14026 | if (spec->auto_mic) |
| 14027 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14028 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14029 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14030 | else |
| 14031 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14032 | } else { |
| 14033 | spec->adc_nids = alc268_adc_nids; |
| 14034 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14035 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14036 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14037 | /* set default input source */ |
| 14038 | for (i = 0; i < spec->num_adc_nids; i++) |
| 14039 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 14040 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 14041 | i < spec->num_mux_defs ? |
| 14042 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14043 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14044 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14045 | |
| 14046 | spec->vmaster_nid = 0x02; |
| 14047 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14048 | codec->patch_ops = alc_patch_ops; |
| 14049 | if (board_config == ALC268_AUTO) |
| 14050 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14051 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14052 | alc_init_jacks(codec); |
| 14053 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14054 | return 0; |
| 14055 | } |
| 14056 | |
| 14057 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14058 | * ALC269 channel source setting (2 channel) |
| 14059 | */ |
| 14060 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14061 | |
| 14062 | #define alc269_dac_nids alc260_dac_nids |
| 14063 | |
| 14064 | static hda_nid_t alc269_adc_nids[1] = { |
| 14065 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14066 | 0x08, |
| 14067 | }; |
| 14068 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14069 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14070 | 0x23, |
| 14071 | }; |
| 14072 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14073 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14074 | /* ADC1 */ |
| 14075 | 0x09, |
| 14076 | }; |
| 14077 | |
| 14078 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14079 | 0x22, |
| 14080 | }; |
| 14081 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14082 | static hda_nid_t alc269_adc_candidates[] = { |
| 14083 | 0x08, 0x09, 0x07, |
| 14084 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14085 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14086 | #define alc269_modes alc260_modes |
| 14087 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14088 | |
| 14089 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14090 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14091 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14092 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14093 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14094 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14095 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14096 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14097 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14098 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14099 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14100 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14101 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14102 | { } /* end */ |
| 14103 | }; |
| 14104 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14105 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14106 | /* output mixer control */ |
| 14107 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14108 | { |
| 14109 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14110 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14111 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14112 | .info = snd_hda_mixer_amp_switch_info, |
| 14113 | .get = snd_hda_mixer_amp_switch_get, |
| 14114 | .put = alc268_acer_master_sw_put, |
| 14115 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14116 | }, |
| 14117 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14118 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14119 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14120 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14121 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14122 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14123 | { } |
| 14124 | }; |
| 14125 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14126 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14127 | /* output mixer control */ |
| 14128 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14129 | { |
| 14130 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14131 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14132 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14133 | .info = snd_hda_mixer_amp_switch_info, |
| 14134 | .get = snd_hda_mixer_amp_switch_get, |
| 14135 | .put = alc268_acer_master_sw_put, |
| 14136 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14137 | }, |
| 14138 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14139 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14140 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14141 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14142 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14143 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14144 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14145 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14146 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14147 | { } |
| 14148 | }; |
| 14149 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14150 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14151 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14152 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14153 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14154 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14155 | { } /* end */ |
| 14156 | }; |
| 14157 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14158 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14159 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14160 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14161 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14162 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14163 | { } /* end */ |
| 14164 | }; |
| 14165 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14166 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14167 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14168 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14169 | { } /* end */ |
| 14170 | }; |
| 14171 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14172 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14173 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14174 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14175 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14176 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14177 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14178 | { } /* end */ |
| 14179 | }; |
| 14180 | |
| 14181 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14182 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14183 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14184 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14185 | { } /* end */ |
| 14186 | }; |
| 14187 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14188 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14189 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14190 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14191 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14192 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14193 | { } /* end */ |
| 14194 | }; |
| 14195 | |
| 14196 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14197 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14198 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14199 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14200 | { } /* end */ |
| 14201 | }; |
| 14202 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14203 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14204 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14205 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14206 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14207 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14208 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14209 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14210 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14211 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14212 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14213 | { } |
| 14214 | }; |
| 14215 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14216 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14217 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14218 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14219 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14220 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14221 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14222 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14223 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14224 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14225 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14226 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14227 | { } |
| 14228 | }; |
| 14229 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14230 | /* toggle speaker-output according to the hp-jack state */ |
| 14231 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14232 | { |
| 14233 | unsigned int present; |
| 14234 | unsigned char bits; |
| 14235 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14236 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14237 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14238 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14239 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14240 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14241 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14242 | |
| 14243 | snd_hda_codec_write(codec, 0x20, 0, |
| 14244 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14245 | snd_hda_codec_write(codec, 0x20, 0, |
| 14246 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14247 | |
| 14248 | snd_hda_codec_write(codec, 0x20, 0, |
| 14249 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14250 | snd_hda_codec_write(codec, 0x20, 0, |
| 14251 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14252 | } |
| 14253 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14254 | /* toggle speaker-output according to the hp-jacks state */ |
| 14255 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14256 | { |
| 14257 | unsigned int present; |
| 14258 | unsigned char bits; |
| 14259 | |
| 14260 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14261 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14262 | |
| 14263 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14264 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14265 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14266 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14267 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14268 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14269 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14270 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14271 | |
| 14272 | snd_hda_codec_write(codec, 0x20, 0, |
| 14273 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14274 | snd_hda_codec_write(codec, 0x20, 0, |
| 14275 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14276 | |
| 14277 | snd_hda_codec_write(codec, 0x20, 0, |
| 14278 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14279 | snd_hda_codec_write(codec, 0x20, 0, |
| 14280 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14281 | } |
| 14282 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14283 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14284 | { |
| 14285 | unsigned int present_laptop; |
| 14286 | unsigned int present_dock; |
| 14287 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14288 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14289 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14290 | |
| 14291 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14292 | if (present_dock) |
| 14293 | snd_hda_codec_write(codec, 0x23, 0, |
| 14294 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14295 | if (present_laptop) |
| 14296 | snd_hda_codec_write(codec, 0x23, 0, |
| 14297 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14298 | if (!present_dock && !present_laptop) |
| 14299 | snd_hda_codec_write(codec, 0x23, 0, |
| 14300 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14301 | } |
| 14302 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14303 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14304 | unsigned int res) |
| 14305 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14306 | switch (res >> 26) { |
| 14307 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14308 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14309 | break; |
| 14310 | case ALC880_MIC_EVENT: |
| 14311 | alc_mic_automute(codec); |
| 14312 | break; |
| 14313 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14314 | } |
| 14315 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14316 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14317 | unsigned int res) |
| 14318 | { |
| 14319 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14320 | alc269_lifebook_speaker_automute(codec); |
| 14321 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14322 | alc269_lifebook_mic_autoswitch(codec); |
| 14323 | } |
| 14324 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14325 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14326 | { |
| 14327 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14328 | spec->autocfg.hp_pins[0] = 0x15; |
| 14329 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14330 | spec->ext_mic.pin = 0x18; |
| 14331 | spec->ext_mic.mux_idx = 0; |
| 14332 | spec->int_mic.pin = 0x19; |
| 14333 | spec->int_mic.mux_idx = 1; |
| 14334 | spec->auto_mic = 1; |
| 14335 | } |
| 14336 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14337 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14338 | { |
| 14339 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14340 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14341 | } |
| 14342 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14343 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14344 | { |
| 14345 | alc269_lifebook_speaker_automute(codec); |
| 14346 | alc269_lifebook_mic_autoswitch(codec); |
| 14347 | } |
| 14348 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14349 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14350 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14351 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14352 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14353 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14354 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14355 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14356 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14357 | {} |
| 14358 | }; |
| 14359 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14360 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14361 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14362 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14363 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14364 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14365 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14366 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14367 | {} |
| 14368 | }; |
| 14369 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14370 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14371 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14372 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14373 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14374 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14375 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14376 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14377 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14378 | {} |
| 14379 | }; |
| 14380 | |
| 14381 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14382 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14383 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14384 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14385 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14386 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14387 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14388 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14389 | {} |
| 14390 | }; |
| 14391 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14392 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14393 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14394 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14395 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14396 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14397 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14398 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14399 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14400 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14401 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14402 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14403 | { } |
| 14404 | }; |
| 14405 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14406 | /* toggle speaker-output according to the hp-jack state */ |
| 14407 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14408 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14409 | struct alc_spec *spec = codec->spec; |
| 14410 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14411 | unsigned int present; |
| 14412 | unsigned char bits; |
| 14413 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14414 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14415 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14416 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14417 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14418 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14419 | HDA_AMP_MUTE, bits); |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14420 | alc_report_jack(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14421 | } |
| 14422 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14423 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14424 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14425 | unsigned int res) |
| 14426 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14427 | switch (res >> 26) { |
| 14428 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14429 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14430 | break; |
| 14431 | case ALC880_MIC_EVENT: |
| 14432 | alc_mic_automute(codec); |
| 14433 | break; |
| 14434 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14435 | } |
| 14436 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14437 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14438 | { |
| 14439 | struct alc_spec *spec = codec->spec; |
| 14440 | spec->autocfg.hp_pins[0] = 0x15; |
| 14441 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14442 | spec->ext_mic.pin = 0x18; |
| 14443 | spec->ext_mic.mux_idx = 0; |
| 14444 | spec->int_mic.pin = 0x19; |
| 14445 | spec->int_mic.mux_idx = 1; |
| 14446 | spec->auto_mic = 1; |
| 14447 | } |
| 14448 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14449 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14450 | { |
| 14451 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14452 | spec->autocfg.hp_pins[0] = 0x15; |
| 14453 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14454 | spec->ext_mic.pin = 0x18; |
| 14455 | spec->ext_mic.mux_idx = 0; |
| 14456 | spec->int_mic.pin = 0x12; |
| 14457 | spec->int_mic.mux_idx = 5; |
| 14458 | spec->auto_mic = 1; |
| 14459 | } |
| 14460 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14461 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14462 | { |
| 14463 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14464 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14465 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14466 | spec->ext_mic.pin = 0x18; |
| 14467 | spec->ext_mic.mux_idx = 0; |
| 14468 | spec->int_mic.pin = 0x19; |
| 14469 | spec->int_mic.mux_idx = 1; |
| 14470 | spec->auto_mic = 1; |
| 14471 | } |
| 14472 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14473 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14474 | { |
| 14475 | struct alc_spec *spec = codec->spec; |
| 14476 | spec->autocfg.hp_pins[0] = 0x21; |
| 14477 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14478 | spec->ext_mic.pin = 0x18; |
| 14479 | spec->ext_mic.mux_idx = 0; |
| 14480 | spec->int_mic.pin = 0x12; |
| 14481 | spec->int_mic.mux_idx = 6; |
| 14482 | spec->auto_mic = 1; |
| 14483 | } |
| 14484 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14485 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14486 | { |
| 14487 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14488 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14489 | } |
| 14490 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14491 | /* |
| 14492 | * generic initialization of ADC, input mixers and output mixers |
| 14493 | */ |
| 14494 | static struct hda_verb alc269_init_verbs[] = { |
| 14495 | /* |
| 14496 | * Unmute ADC0 and set the default input to mic-in |
| 14497 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14498 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14499 | |
| 14500 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14501 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14502 | */ |
| 14503 | /* set vol=0 to output mixers */ |
| 14504 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14505 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14506 | |
| 14507 | /* set up input amps for analog loopback */ |
| 14508 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14509 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14510 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14511 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14512 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14513 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14514 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14515 | |
| 14516 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14517 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14518 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14519 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14520 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14521 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14522 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14523 | |
| 14524 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14525 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14526 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14527 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14528 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14529 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14530 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14531 | |
| 14532 | /* set EAPD */ |
| 14533 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14534 | { } |
| 14535 | }; |
| 14536 | |
| 14537 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14538 | /* |
| 14539 | * Unmute ADC0 and set the default input to mic-in |
| 14540 | */ |
| 14541 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14542 | |
| 14543 | /* |
| 14544 | * Set up output mixers (0x02 - 0x03) |
| 14545 | */ |
| 14546 | /* set vol=0 to output mixers */ |
| 14547 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14548 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14549 | |
| 14550 | /* set up input amps for analog loopback */ |
| 14551 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14552 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14553 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14554 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14555 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14556 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14557 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14558 | |
| 14559 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14560 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14561 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14562 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14563 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14564 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14565 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14566 | |
| 14567 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14568 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14569 | |
| 14570 | /* FIXME: use Mux-type input source selection */ |
| 14571 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14572 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14573 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14574 | |
| 14575 | /* set EAPD */ |
| 14576 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14577 | { } |
| 14578 | }; |
| 14579 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14580 | #define alc269_auto_create_multi_out_ctls \ |
| 14581 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14582 | #define alc269_auto_create_input_ctls \ |
| 14583 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14584 | |
| 14585 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14586 | #define alc269_loopbacks alc880_loopbacks |
| 14587 | #endif |
| 14588 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14589 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14590 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14591 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14592 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14593 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14594 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14595 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14596 | .substreams = 1, |
| 14597 | .channels_min = 2, |
| 14598 | .channels_max = 8, |
| 14599 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14600 | /* NID is set in alc_build_pcms */ |
| 14601 | .ops = { |
| 14602 | .open = alc880_playback_pcm_open, |
| 14603 | .prepare = alc880_playback_pcm_prepare, |
| 14604 | .cleanup = alc880_playback_pcm_cleanup |
| 14605 | }, |
| 14606 | }; |
| 14607 | |
| 14608 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14609 | .substreams = 1, |
| 14610 | .channels_min = 2, |
| 14611 | .channels_max = 2, |
| 14612 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14613 | /* NID is set in alc_build_pcms */ |
| 14614 | }; |
| 14615 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14616 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14617 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14618 | { |
| 14619 | switch (codec->subsystem_id) { |
| 14620 | case 0x103c1586: |
| 14621 | return 1; |
| 14622 | } |
| 14623 | return 0; |
| 14624 | } |
| 14625 | |
| 14626 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14627 | { |
| 14628 | /* update mute-LED according to the speaker mute state */ |
| 14629 | if (nid == 0x01 || nid == 0x14) { |
| 14630 | int pinval; |
| 14631 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14632 | HDA_AMP_MUTE) |
| 14633 | pinval = 0x24; |
| 14634 | else |
| 14635 | pinval = 0x20; |
| 14636 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14637 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14638 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14639 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14640 | } |
| 14641 | return alc_check_power_status(codec, nid); |
| 14642 | } |
| 14643 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14644 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14645 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14646 | { |
| 14647 | struct alc_spec *spec = codec->spec; |
| 14648 | |
| 14649 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14650 | return 0; |
| 14651 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14652 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14653 | if (spec->ext_mic.pin <= 0x12) { |
| 14654 | spec->private_adc_nids[0] = 0x08; |
| 14655 | spec->private_adc_nids[1] = 0x11; |
| 14656 | spec->private_capsrc_nids[0] = 0x23; |
| 14657 | spec->private_capsrc_nids[1] = 0x22; |
| 14658 | } else { |
| 14659 | spec->private_adc_nids[0] = 0x11; |
| 14660 | spec->private_adc_nids[1] = 0x08; |
| 14661 | spec->private_capsrc_nids[0] = 0x22; |
| 14662 | spec->private_capsrc_nids[1] = 0x23; |
| 14663 | } |
| 14664 | spec->adc_nids = spec->private_adc_nids; |
| 14665 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14666 | spec->num_adc_nids = 2; |
| 14667 | spec->dual_adc_switch = 1; |
| 14668 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14669 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14670 | return 1; |
| 14671 | } |
| 14672 | return 0; |
| 14673 | } |
| 14674 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14675 | /* different alc269-variants */ |
| 14676 | enum { |
| 14677 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14678 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14679 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14680 | ALC269_TYPE_ALC269VB, |
| 14681 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14682 | ALC269_TYPE_ALC271X, |
| 14683 | }; |
| 14684 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14685 | /* |
| 14686 | * BIOS auto configuration |
| 14687 | */ |
| 14688 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14689 | { |
| 14690 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14691 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14692 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14693 | |
| 14694 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14695 | alc269_ignore); |
| 14696 | if (err < 0) |
| 14697 | return err; |
| 14698 | |
| 14699 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14700 | if (err < 0) |
| 14701 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14702 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14703 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14704 | else |
| 14705 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14706 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14707 | if (err < 0) |
| 14708 | return err; |
| 14709 | |
| 14710 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14711 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14712 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14713 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14714 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14715 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14716 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14717 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14718 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14719 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14720 | } else { |
| 14721 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14722 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14723 | } |
| 14724 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14725 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14726 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14727 | |
| 14728 | if (!alc275_setup_dual_adc(codec)) |
| 14729 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14730 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14731 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14732 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14733 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14734 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14735 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14736 | |
| 14737 | err = alc_auto_add_mic_boost(codec); |
| 14738 | if (err < 0) |
| 14739 | return err; |
| 14740 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14741 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14742 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14743 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14744 | return 1; |
| 14745 | } |
| 14746 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14747 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14748 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14749 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14750 | |
| 14751 | |
| 14752 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14753 | static void alc269_auto_init(struct hda_codec *codec) |
| 14754 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14755 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14756 | alc269_auto_init_multi_out(codec); |
| 14757 | alc269_auto_init_hp_out(codec); |
| 14758 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14759 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14760 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14761 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14762 | } |
| 14763 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14764 | #ifdef SND_HDA_NEEDS_RESUME |
| 14765 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14766 | { |
| 14767 | int val = alc_read_coef_idx(codec, 0x04); |
| 14768 | if (power_up) |
| 14769 | val |= 1 << 11; |
| 14770 | else |
| 14771 | val &= ~(1 << 11); |
| 14772 | alc_write_coef_idx(codec, 0x04, val); |
| 14773 | } |
| 14774 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14775 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14776 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14777 | { |
| 14778 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14779 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14780 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14781 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14782 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14783 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14784 | msleep(150); |
| 14785 | } |
| 14786 | |
| 14787 | alc_shutup(codec); |
| 14788 | if (spec && spec->power_hook) |
| 14789 | spec->power_hook(codec); |
| 14790 | return 0; |
| 14791 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14792 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14793 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14794 | static int alc269_resume(struct hda_codec *codec) |
| 14795 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14796 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14797 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14798 | msleep(150); |
| 14799 | } |
| 14800 | |
| 14801 | codec->patch_ops.init(codec); |
| 14802 | |
| 14803 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14804 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14805 | msleep(200); |
| 14806 | } |
| 14807 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14808 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14809 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14810 | |
| 14811 | snd_hda_codec_resume_amp(codec); |
| 14812 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14813 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14814 | return 0; |
| 14815 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14816 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14817 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame^] | 14818 | static void alc269_fixup_hweq(struct hda_codec *codec, |
| 14819 | const struct alc_fixup *fix, int pre_init) |
| 14820 | { |
| 14821 | int coef; |
| 14822 | |
| 14823 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14824 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14825 | } |
| 14826 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14827 | enum { |
| 14828 | ALC269_FIXUP_SONY_VAIO, |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14829 | ALC275_FIX_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14830 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14831 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14832 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14833 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame^] | 14834 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14835 | }; |
| 14836 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14837 | static const struct alc_fixup alc269_fixups[] = { |
| 14838 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14839 | .verbs = (const struct hda_verb[]) { |
| 14840 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14841 | {} |
| 14842 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14843 | }, |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14844 | [ALC275_FIX_SONY_VAIO_GPIO2] = { |
| 14845 | .verbs = (const struct hda_verb[]) { |
| 14846 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14847 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14848 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14849 | { } |
| 14850 | } |
| 14851 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14852 | [ALC269_FIXUP_DELL_M101Z] = { |
| 14853 | .verbs = (const struct hda_verb[]) { |
| 14854 | /* Enables internal speaker */ |
| 14855 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14856 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14857 | {} |
| 14858 | } |
| 14859 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14860 | [ALC269_FIXUP_SKU_IGNORE] = { |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14861 | .sku = ALC_FIXUP_SKU_IGNORE, |
| 14862 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14863 | [ALC269_FIXUP_ASUS_G73JW] = { |
| 14864 | .pins = (const struct alc_pincfg[]) { |
| 14865 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14866 | { } |
| 14867 | } |
| 14868 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14869 | [ALC269_FIXUP_LENOVO_EAPD] = { |
| 14870 | .verbs = (const struct hda_verb[]) { |
| 14871 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14872 | {} |
| 14873 | } |
| 14874 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame^] | 14875 | [ALC275_FIXUP_SONY_HWEQ] = { |
| 14876 | .func = alc269_fixup_hweq, |
| 14877 | .verbs = (const struct hda_verb[]) { |
| 14878 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14879 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14880 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14881 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14882 | { } |
| 14883 | } |
| 14884 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14885 | }; |
| 14886 | |
| 14887 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14888 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame^] | 14889 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14890 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | abdd8f5 | 2010-09-21 17:38:14 +0200 | [diff] [blame] | 14891 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14892 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14893 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14894 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14895 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14896 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14897 | {} |
| 14898 | }; |
| 14899 | |
| 14900 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14901 | /* |
| 14902 | * configuration and preset |
| 14903 | */ |
| 14904 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14905 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14906 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14907 | [ALC269_AMIC] = "laptop-amic", |
| 14908 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14909 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14910 | [ALC269_LIFEBOOK] = "lifebook", |
| 14911 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14912 | }; |
| 14913 | |
| 14914 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14915 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14916 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14917 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14918 | ALC269_AMIC), |
| 14919 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14920 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14921 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14922 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14923 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14924 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14925 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14926 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14927 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14928 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14929 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14930 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14931 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14932 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14933 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14934 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14935 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14936 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14937 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14938 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14939 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14940 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14941 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14942 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14943 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14944 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14945 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14946 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14947 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14948 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14949 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14950 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14951 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14952 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14953 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14954 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14955 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14956 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14957 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14958 | ALC269_DMIC), |
| 14959 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14960 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14961 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14962 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14963 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14964 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14965 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14966 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14967 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14968 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14969 | {} |
| 14970 | }; |
| 14971 | |
| 14972 | static struct alc_config_preset alc269_presets[] = { |
| 14973 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14974 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14975 | .init_verbs = { alc269_init_verbs }, |
| 14976 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14977 | .dac_nids = alc269_dac_nids, |
| 14978 | .hp_nid = 0x03, |
| 14979 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14980 | .channel_mode = alc269_modes, |
| 14981 | .input_mux = &alc269_capture_source, |
| 14982 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14983 | [ALC269_QUANTA_FL1] = { |
| 14984 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14985 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14986 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14987 | .dac_nids = alc269_dac_nids, |
| 14988 | .hp_nid = 0x03, |
| 14989 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14990 | .channel_mode = alc269_modes, |
| 14991 | .input_mux = &alc269_capture_source, |
| 14992 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14993 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14994 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14995 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14996 | [ALC269_AMIC] = { |
| 14997 | .mixers = { alc269_laptop_mixer }, |
| 14998 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14999 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15000 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15001 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15002 | .dac_nids = alc269_dac_nids, |
| 15003 | .hp_nid = 0x03, |
| 15004 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15005 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15006 | .unsol_event = alc269_laptop_unsol_event, |
| 15007 | .setup = alc269_laptop_amic_setup, |
| 15008 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15009 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15010 | [ALC269_DMIC] = { |
| 15011 | .mixers = { alc269_laptop_mixer }, |
| 15012 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15013 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15014 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15015 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15016 | .dac_nids = alc269_dac_nids, |
| 15017 | .hp_nid = 0x03, |
| 15018 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15019 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15020 | .unsol_event = alc269_laptop_unsol_event, |
| 15021 | .setup = alc269_laptop_dmic_setup, |
| 15022 | .init_hook = alc269_laptop_inithook, |
| 15023 | }, |
| 15024 | [ALC269VB_AMIC] = { |
| 15025 | .mixers = { alc269vb_laptop_mixer }, |
| 15026 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15027 | .init_verbs = { alc269vb_init_verbs, |
| 15028 | alc269vb_laptop_amic_init_verbs }, |
| 15029 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15030 | .dac_nids = alc269_dac_nids, |
| 15031 | .hp_nid = 0x03, |
| 15032 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15033 | .channel_mode = alc269_modes, |
| 15034 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15035 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15036 | .init_hook = alc269_laptop_inithook, |
| 15037 | }, |
| 15038 | [ALC269VB_DMIC] = { |
| 15039 | .mixers = { alc269vb_laptop_mixer }, |
| 15040 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15041 | .init_verbs = { alc269vb_init_verbs, |
| 15042 | alc269vb_laptop_dmic_init_verbs }, |
| 15043 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15044 | .dac_nids = alc269_dac_nids, |
| 15045 | .hp_nid = 0x03, |
| 15046 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15047 | .channel_mode = alc269_modes, |
| 15048 | .unsol_event = alc269_laptop_unsol_event, |
| 15049 | .setup = alc269vb_laptop_dmic_setup, |
| 15050 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15051 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15052 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15053 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15054 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15055 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15056 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15057 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15058 | .dac_nids = alc269_dac_nids, |
| 15059 | .hp_nid = 0x03, |
| 15060 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15061 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15062 | .unsol_event = alc269_laptop_unsol_event, |
| 15063 | .setup = alc269_laptop_dmic_setup, |
| 15064 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15065 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15066 | [ALC269_LIFEBOOK] = { |
| 15067 | .mixers = { alc269_lifebook_mixer }, |
| 15068 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15069 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15070 | .dac_nids = alc269_dac_nids, |
| 15071 | .hp_nid = 0x03, |
| 15072 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15073 | .channel_mode = alc269_modes, |
| 15074 | .input_mux = &alc269_capture_source, |
| 15075 | .unsol_event = alc269_lifebook_unsol_event, |
| 15076 | .init_hook = alc269_lifebook_init_hook, |
| 15077 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15078 | [ALC271_ACER] = { |
| 15079 | .mixers = { alc269_asus_mixer }, |
| 15080 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15081 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15082 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15083 | .dac_nids = alc269_dac_nids, |
| 15084 | .adc_nids = alc262_dmic_adc_nids, |
| 15085 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15086 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15087 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15088 | .channel_mode = alc269_modes, |
| 15089 | .input_mux = &alc269_capture_source, |
| 15090 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15091 | .unsol_event = alc_sku_unsol_event, |
| 15092 | .setup = alc269vb_laptop_dmic_setup, |
| 15093 | .init_hook = alc_inithook, |
| 15094 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15095 | }; |
| 15096 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15097 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15098 | { |
| 15099 | int val; |
| 15100 | |
| 15101 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15102 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15103 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15104 | } |
| 15105 | |
| 15106 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15107 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15108 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15109 | } |
| 15110 | |
| 15111 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15112 | val = alc_read_coef_idx(codec, 0x04); |
| 15113 | /* Power up output pin */ |
| 15114 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15115 | } |
| 15116 | |
| 15117 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15118 | val = alc_read_coef_idx(codec, 0xd); |
| 15119 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15120 | /* Capless ramp up clock control */ |
| 15121 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15122 | } |
| 15123 | val = alc_read_coef_idx(codec, 0x17); |
| 15124 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15125 | /* Class D power on reset */ |
| 15126 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15127 | } |
| 15128 | } |
| 15129 | return 0; |
| 15130 | } |
| 15131 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15132 | static int patch_alc269(struct hda_codec *codec) |
| 15133 | { |
| 15134 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15135 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15136 | int err; |
| 15137 | |
| 15138 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15139 | if (spec == NULL) |
| 15140 | return -ENOMEM; |
| 15141 | |
| 15142 | codec->spec = spec; |
| 15143 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15144 | alc_auto_parse_customize_define(codec); |
| 15145 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15146 | if (codec->vendor_id == 0x10ec0269) { |
| 15147 | coef = alc_read_coef_idx(codec, 0); |
| 15148 | if ((coef & 0x00f0) == 0x0010) { |
| 15149 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15150 | spec->cdefine.platform_type == 1) { |
| 15151 | alc_codec_rename(codec, "ALC271X"); |
| 15152 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15153 | } else if ((coef & 0xf000) == 0x1000) { |
| 15154 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15155 | } else if ((coef & 0xf000) == 0x2000) { |
| 15156 | alc_codec_rename(codec, "ALC259"); |
| 15157 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15158 | } else if ((coef & 0xf000) == 0x3000) { |
| 15159 | alc_codec_rename(codec, "ALC258"); |
| 15160 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15161 | } else { |
| 15162 | alc_codec_rename(codec, "ALC269VB"); |
| 15163 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15164 | } |
| 15165 | } else |
| 15166 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15167 | alc269_fill_coef(codec); |
| 15168 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15169 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15170 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15171 | alc269_models, |
| 15172 | alc269_cfg_tbl); |
| 15173 | |
| 15174 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15175 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15176 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15177 | board_config = ALC269_AUTO; |
| 15178 | } |
| 15179 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15180 | if (board_config == ALC269_AUTO) |
| 15181 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 15182 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15183 | if (board_config == ALC269_AUTO) { |
| 15184 | /* automatic parse from the BIOS config */ |
| 15185 | err = alc269_parse_auto_config(codec); |
| 15186 | if (err < 0) { |
| 15187 | alc_free(codec); |
| 15188 | return err; |
| 15189 | } else if (!err) { |
| 15190 | printk(KERN_INFO |
| 15191 | "hda_codec: Cannot set up configuration " |
| 15192 | "from BIOS. Using base mode...\n"); |
| 15193 | board_config = ALC269_BASIC; |
| 15194 | } |
| 15195 | } |
| 15196 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15197 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15198 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15199 | if (err < 0) { |
| 15200 | alc_free(codec); |
| 15201 | return err; |
| 15202 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15203 | } |
| 15204 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15205 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15206 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15207 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15208 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15209 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15210 | * fix the sample rate of analog I/O to 44.1kHz |
| 15211 | */ |
| 15212 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15213 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15214 | } else if (spec->dual_adc_switch) { |
| 15215 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15216 | /* switch ADC dynamically */ |
| 15217 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15218 | } else { |
| 15219 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15220 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15221 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15222 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15223 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15224 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15225 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15226 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15227 | spec->adc_nids = alc269_adc_nids; |
| 15228 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15229 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15230 | } else { |
| 15231 | spec->adc_nids = alc269vb_adc_nids; |
| 15232 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15233 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15234 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15235 | } |
| 15236 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15237 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15238 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15239 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15240 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15241 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15242 | if (board_config == ALC269_AUTO) |
| 15243 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 15244 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15245 | spec->vmaster_nid = 0x02; |
| 15246 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15247 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15248 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15249 | codec->patch_ops.suspend = alc269_suspend; |
| 15250 | #endif |
| 15251 | #ifdef SND_HDA_NEEDS_RESUME |
| 15252 | codec->patch_ops.resume = alc269_resume; |
| 15253 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15254 | if (board_config == ALC269_AUTO) |
| 15255 | spec->init_hook = alc269_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15256 | |
| 15257 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15258 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15259 | if (!spec->loopback.amplist) |
| 15260 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15261 | if (alc269_mic2_for_mute_led(codec)) |
| 15262 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15263 | #endif |
| 15264 | |
| 15265 | return 0; |
| 15266 | } |
| 15267 | |
| 15268 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15269 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15270 | */ |
| 15271 | |
| 15272 | /* |
| 15273 | * set the path ways for 2 channel output |
| 15274 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15275 | */ |
| 15276 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15277 | /* set pin widget 1Ah (line in) for input */ |
| 15278 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15279 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15280 | * the vref |
| 15281 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15282 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15283 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15284 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15285 | #if 0 |
| 15286 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15287 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15288 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15289 | { } /* end */ |
| 15290 | }; |
| 15291 | /* |
| 15292 | * 6ch mode |
| 15293 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15294 | */ |
| 15295 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15296 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15297 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15298 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15299 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15300 | |
| 15301 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15302 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15303 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15304 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15305 | #if 0 |
| 15306 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15307 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15308 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15309 | { } /* end */ |
| 15310 | }; |
| 15311 | |
| 15312 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15313 | { 2, alc861_threestack_ch2_init }, |
| 15314 | { 6, alc861_threestack_ch6_init }, |
| 15315 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15316 | /* Set mic1 as input and unmute the mixer */ |
| 15317 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15318 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15319 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15320 | { } /* end */ |
| 15321 | }; |
| 15322 | /* Set mic1 as output and mute mixer */ |
| 15323 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15324 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15325 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15326 | { } /* end */ |
| 15327 | }; |
| 15328 | |
| 15329 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15330 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15331 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15332 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15333 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15334 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15335 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15336 | /* set pin widget 1Ah (line in) for input */ |
| 15337 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15338 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15339 | * the vref |
| 15340 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15341 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15342 | |
| 15343 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15344 | #if 0 |
| 15345 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15346 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15347 | #endif |
| 15348 | { } /* end */ |
| 15349 | }; |
| 15350 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15351 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15352 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15353 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15354 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15355 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15356 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15357 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15358 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15359 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15360 | |
| 15361 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15362 | #if 0 |
| 15363 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15364 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15365 | #endif |
| 15366 | { } /* end */ |
| 15367 | }; |
| 15368 | |
| 15369 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15370 | { 2, alc861_asus_ch2_init }, |
| 15371 | { 6, alc861_asus_ch6_init }, |
| 15372 | }; |
| 15373 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15374 | /* patch-ALC861 */ |
| 15375 | |
| 15376 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15377 | /* output mixer control */ |
| 15378 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15379 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15380 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15381 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15382 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15383 | |
| 15384 | /*Input mixer control */ |
| 15385 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15386 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15387 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15388 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15389 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15390 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15391 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15392 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15393 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15394 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15395 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15396 | { } /* end */ |
| 15397 | }; |
| 15398 | |
| 15399 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15400 | /* output mixer control */ |
| 15401 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15402 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15403 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15404 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15405 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15406 | |
| 15407 | /* Input mixer control */ |
| 15408 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15409 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15410 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15411 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15412 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15413 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15414 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15415 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15416 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15417 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15418 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15419 | { |
| 15420 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15421 | .name = "Channel Mode", |
| 15422 | .info = alc_ch_mode_info, |
| 15423 | .get = alc_ch_mode_get, |
| 15424 | .put = alc_ch_mode_put, |
| 15425 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15426 | }, |
| 15427 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15428 | }; |
| 15429 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15430 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15431 | /* output mixer control */ |
| 15432 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15433 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15434 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15435 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15436 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15437 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15438 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15439 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15440 | /* output mixer control */ |
| 15441 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15442 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15443 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15444 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15445 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15446 | |
| 15447 | /* Input mixer control */ |
| 15448 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15449 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15450 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15451 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15452 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15453 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15454 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15455 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15456 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15457 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15458 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15459 | { |
| 15460 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15461 | .name = "Channel Mode", |
| 15462 | .info = alc_ch_mode_info, |
| 15463 | .get = alc_ch_mode_get, |
| 15464 | .put = alc_ch_mode_put, |
| 15465 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15466 | }, |
| 15467 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15468 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15469 | |
| 15470 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15471 | /* output mixer control */ |
| 15472 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15473 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15474 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15475 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15476 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15477 | |
| 15478 | /* Input mixer control */ |
| 15479 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15480 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15481 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15482 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15483 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15484 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15485 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15486 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15487 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15488 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15489 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15490 | { |
| 15491 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15492 | .name = "Channel Mode", |
| 15493 | .info = alc_ch_mode_info, |
| 15494 | .get = alc_ch_mode_get, |
| 15495 | .put = alc_ch_mode_put, |
| 15496 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15497 | }, |
| 15498 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15499 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15500 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15501 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15502 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15503 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15504 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15505 | { } |
| 15506 | }; |
| 15507 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15508 | /* |
| 15509 | * generic initialization of ADC, input mixers and output mixers |
| 15510 | */ |
| 15511 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15512 | /* |
| 15513 | * Unmute ADC0 and set the default input to mic-in |
| 15514 | */ |
| 15515 | /* port-A for surround (rear panel) */ |
| 15516 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15517 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15518 | /* port-B for mic-in (rear panel) with vref */ |
| 15519 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15520 | /* port-C for line-in (rear panel) */ |
| 15521 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15522 | /* port-D for Front */ |
| 15523 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15524 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15525 | /* port-E for HP out (front panel) */ |
| 15526 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15527 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15528 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15529 | /* port-F for mic-in (front panel) with vref */ |
| 15530 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15531 | /* port-G for CLFE (rear panel) */ |
| 15532 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15533 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15534 | /* port-H for side (rear panel) */ |
| 15535 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15536 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15537 | /* CD-in */ |
| 15538 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15539 | /* route front mic to ADC1*/ |
| 15540 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15541 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15542 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15543 | /* Unmute DAC0~3 & spdif out*/ |
| 15544 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15545 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15546 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15547 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15549 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15550 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15551 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15552 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15553 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15554 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15555 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15556 | /* Unmute Stereo Mixer 15 */ |
| 15557 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15558 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15559 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15560 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15561 | |
| 15562 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15563 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15564 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15565 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15566 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15567 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15568 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15569 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15570 | /* hp used DAC 3 (Front) */ |
| 15571 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15572 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15573 | |
| 15574 | { } |
| 15575 | }; |
| 15576 | |
| 15577 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15578 | /* |
| 15579 | * Unmute ADC0 and set the default input to mic-in |
| 15580 | */ |
| 15581 | /* port-A for surround (rear panel) */ |
| 15582 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15583 | /* port-B for mic-in (rear panel) with vref */ |
| 15584 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15585 | /* port-C for line-in (rear panel) */ |
| 15586 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15587 | /* port-D for Front */ |
| 15588 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15589 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15590 | /* port-E for HP out (front panel) */ |
| 15591 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15592 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15593 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15594 | /* port-F for mic-in (front panel) with vref */ |
| 15595 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15596 | /* port-G for CLFE (rear panel) */ |
| 15597 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15598 | /* port-H for side (rear panel) */ |
| 15599 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15600 | /* CD-in */ |
| 15601 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15602 | /* route front mic to ADC1*/ |
| 15603 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15604 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15605 | /* Unmute DAC0~3 & spdif out*/ |
| 15606 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15607 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15608 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15609 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15610 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15611 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15612 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15613 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15614 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15615 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15616 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15617 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15618 | /* Unmute Stereo Mixer 15 */ |
| 15619 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15620 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15621 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15622 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15623 | |
| 15624 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15625 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15626 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15627 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15628 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15629 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15630 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15631 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15632 | /* hp used DAC 3 (Front) */ |
| 15633 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15634 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15635 | { } |
| 15636 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15637 | |
| 15638 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15639 | /* |
| 15640 | * Unmute ADC0 and set the default input to mic-in |
| 15641 | */ |
| 15642 | /* port-A for surround (rear panel) */ |
| 15643 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15644 | /* port-B for mic-in (rear panel) with vref */ |
| 15645 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15646 | /* port-C for line-in (rear panel) */ |
| 15647 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15648 | /* port-D for Front */ |
| 15649 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15650 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15651 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15652 | /* this has to be set to VREF80 */ |
| 15653 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15654 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15655 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15656 | /* port-F for mic-in (front panel) with vref */ |
| 15657 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15658 | /* port-G for CLFE (rear panel) */ |
| 15659 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15660 | /* port-H for side (rear panel) */ |
| 15661 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15662 | /* CD-in */ |
| 15663 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15664 | /* route front mic to ADC1*/ |
| 15665 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15666 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15667 | /* Unmute DAC0~3 & spdif out*/ |
| 15668 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15669 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15670 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15671 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15672 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15673 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15674 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15675 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15676 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15677 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15678 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15679 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15680 | /* Unmute Stereo Mixer 15 */ |
| 15681 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15682 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15683 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15684 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15685 | |
| 15686 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15687 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15688 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15689 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15690 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15691 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15692 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15693 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15694 | /* hp used DAC 3 (Front) */ |
| 15695 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15696 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15697 | { } |
| 15698 | }; |
| 15699 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15700 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15701 | /* |
| 15702 | * Unmute ADC0 and set the default input to mic-in |
| 15703 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15704 | /* port-A for surround (rear panel) |
| 15705 | * according to codec#0 this is the HP jack |
| 15706 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15707 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15708 | /* route front PCM to HP */ |
| 15709 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15710 | /* port-B for mic-in (rear panel) with vref */ |
| 15711 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15712 | /* port-C for line-in (rear panel) */ |
| 15713 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15714 | /* port-D for Front */ |
| 15715 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15716 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15717 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15718 | /* this has to be set to VREF80 */ |
| 15719 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15720 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15721 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15722 | /* port-F for mic-in (front panel) with vref */ |
| 15723 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15724 | /* port-G for CLFE (rear panel) */ |
| 15725 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15726 | /* port-H for side (rear panel) */ |
| 15727 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15728 | /* CD-in */ |
| 15729 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15730 | /* route front mic to ADC1*/ |
| 15731 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15732 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15733 | /* Unmute DAC0~3 & spdif out*/ |
| 15734 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15735 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15736 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15737 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15738 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15739 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15740 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15741 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15742 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15743 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15744 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15745 | /* Unmute Stereo Mixer 15 */ |
| 15746 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15747 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15748 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15749 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15750 | |
| 15751 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15752 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15753 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15754 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15755 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15756 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15757 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15758 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15759 | /* hp used DAC 3 (Front) */ |
| 15760 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15761 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15762 | { } |
| 15763 | }; |
| 15764 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15765 | /* additional init verbs for ASUS laptops */ |
| 15766 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15767 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15768 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15769 | { } |
| 15770 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15771 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15772 | /* |
| 15773 | * generic initialization of ADC, input mixers and output mixers |
| 15774 | */ |
| 15775 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15776 | /* |
| 15777 | * Unmute ADC0 and set the default input to mic-in |
| 15778 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15779 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15780 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15781 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15782 | /* Unmute DAC0~3 & spdif out*/ |
| 15783 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15784 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15785 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15786 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15787 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15788 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15789 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15790 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15791 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15792 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15793 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15794 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15795 | /* Unmute Stereo Mixer 15 */ |
| 15796 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15797 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15798 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15799 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15800 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15801 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15802 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15803 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15804 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15805 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15806 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15807 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15808 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15809 | |
| 15810 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15811 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15812 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15813 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15814 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15815 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15816 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15817 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15818 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15819 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15820 | |
| 15821 | { } |
| 15822 | }; |
| 15823 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15824 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15825 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15826 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15827 | { } |
| 15828 | }; |
| 15829 | |
| 15830 | /* toggle speaker-output according to the hp-jack state */ |
| 15831 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15832 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15833 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15834 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15835 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15836 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15837 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15838 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15839 | } |
| 15840 | |
| 15841 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15842 | unsigned int res) |
| 15843 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15844 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15845 | alc861_toshiba_automute(codec); |
| 15846 | } |
| 15847 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15848 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15849 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15850 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15851 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15852 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15853 | |
| 15854 | |
| 15855 | #define ALC861_DIGOUT_NID 0x07 |
| 15856 | |
| 15857 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15858 | { 8, NULL } |
| 15859 | }; |
| 15860 | |
| 15861 | static hda_nid_t alc861_dac_nids[4] = { |
| 15862 | /* front, surround, clfe, side */ |
| 15863 | 0x03, 0x06, 0x05, 0x04 |
| 15864 | }; |
| 15865 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15866 | static hda_nid_t alc660_dac_nids[3] = { |
| 15867 | /* front, clfe, surround */ |
| 15868 | 0x03, 0x05, 0x06 |
| 15869 | }; |
| 15870 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15871 | static hda_nid_t alc861_adc_nids[1] = { |
| 15872 | /* ADC0-2 */ |
| 15873 | 0x08, |
| 15874 | }; |
| 15875 | |
| 15876 | static struct hda_input_mux alc861_capture_source = { |
| 15877 | .num_items = 5, |
| 15878 | .items = { |
| 15879 | { "Mic", 0x0 }, |
| 15880 | { "Front Mic", 0x3 }, |
| 15881 | { "Line", 0x1 }, |
| 15882 | { "CD", 0x4 }, |
| 15883 | { "Mixer", 0x5 }, |
| 15884 | }, |
| 15885 | }; |
| 15886 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15887 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15888 | { |
| 15889 | struct alc_spec *spec = codec->spec; |
| 15890 | hda_nid_t mix, srcs[5]; |
| 15891 | int i, j, num; |
| 15892 | |
| 15893 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15894 | return 0; |
| 15895 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15896 | if (num < 0) |
| 15897 | return 0; |
| 15898 | for (i = 0; i < num; i++) { |
| 15899 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15900 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15901 | if (type != AC_WID_AUD_OUT) |
| 15902 | continue; |
| 15903 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15904 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15905 | break; |
| 15906 | if (j >= spec->multiout.num_dacs) |
| 15907 | return srcs[i]; |
| 15908 | } |
| 15909 | return 0; |
| 15910 | } |
| 15911 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15912 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15913 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15914 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15915 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15916 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15917 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15918 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15919 | |
| 15920 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15921 | for (i = 0; i < cfg->line_outs; i++) { |
| 15922 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15923 | dac = alc861_look_for_dac(codec, nid); |
| 15924 | if (!dac) |
| 15925 | continue; |
| 15926 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15927 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15928 | return 0; |
| 15929 | } |
| 15930 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15931 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15932 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15933 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15934 | 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] | 15935 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15936 | } |
| 15937 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15938 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 15939 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 15940 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15941 | /* add playback controls from the parsed DAC table */ |
| 15942 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15943 | const struct auto_pin_cfg *cfg) |
| 15944 | { |
| 15945 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15946 | static const char *chname[4] = { |
| 15947 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15948 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15949 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15950 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15951 | int i, err; |
| 15952 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15953 | for (i = 0; i < cfg->line_outs; i++) { |
| 15954 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15955 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15956 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15957 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15958 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15959 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15960 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15961 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15962 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15963 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15964 | return err; |
| 15965 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15966 | const char *name = pfx; |
| 15967 | if (!name) |
| 15968 | name = chname[i]; |
| 15969 | err = __alc861_create_out_sw(codec, name, nid, i, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15970 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15971 | return err; |
| 15972 | } |
| 15973 | } |
| 15974 | return 0; |
| 15975 | } |
| 15976 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15977 | 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] | 15978 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15979 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15980 | int err; |
| 15981 | hda_nid_t nid; |
| 15982 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15983 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15984 | return 0; |
| 15985 | |
| 15986 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15987 | nid = alc861_look_for_dac(codec, pin); |
| 15988 | if (nid) { |
| 15989 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15990 | if (err < 0) |
| 15991 | return err; |
| 15992 | spec->multiout.hp_nid = nid; |
| 15993 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15994 | } |
| 15995 | return 0; |
| 15996 | } |
| 15997 | |
| 15998 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15999 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16000 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16001 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16002 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16003 | } |
| 16004 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16005 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16006 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16007 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16008 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16009 | hda_nid_t mix, srcs[5]; |
| 16010 | int i, num; |
| 16011 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16012 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16013 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16014 | 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] | 16015 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16016 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 16017 | return; |
| 16018 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 16019 | if (num < 0) |
| 16020 | return; |
| 16021 | for (i = 0; i < num; i++) { |
| 16022 | unsigned int mute; |
| 16023 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 16024 | mute = AMP_IN_UNMUTE(i); |
| 16025 | else |
| 16026 | mute = AMP_IN_MUTE(i); |
| 16027 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16028 | mute); |
| 16029 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16030 | } |
| 16031 | |
| 16032 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 16033 | { |
| 16034 | struct alc_spec *spec = codec->spec; |
| 16035 | int i; |
| 16036 | |
| 16037 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 16038 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16039 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16040 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16041 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16042 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16043 | } |
| 16044 | } |
| 16045 | |
| 16046 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 16047 | { |
| 16048 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16049 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16050 | if (spec->autocfg.hp_outs) |
| 16051 | alc861_auto_set_output_and_unmute(codec, |
| 16052 | spec->autocfg.hp_pins[0], |
| 16053 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16054 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16055 | if (spec->autocfg.speaker_outs) |
| 16056 | alc861_auto_set_output_and_unmute(codec, |
| 16057 | spec->autocfg.speaker_pins[0], |
| 16058 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16059 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16060 | } |
| 16061 | |
| 16062 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16063 | { |
| 16064 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16065 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16066 | int i; |
| 16067 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16068 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16069 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16070 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16071 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16072 | } |
| 16073 | } |
| 16074 | |
| 16075 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16076 | /* return 1 if successful, 0 if the proper config is not found, |
| 16077 | * or a negative error code |
| 16078 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16079 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16080 | { |
| 16081 | struct alc_spec *spec = codec->spec; |
| 16082 | int err; |
| 16083 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 16084 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16085 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16086 | alc861_ignore); |
| 16087 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16088 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16089 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16090 | return 0; /* can't find valid BIOS pin config */ |
| 16091 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16092 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16093 | if (err < 0) |
| 16094 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16095 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16096 | if (err < 0) |
| 16097 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16098 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16099 | if (err < 0) |
| 16100 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16101 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16102 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16103 | return err; |
| 16104 | |
| 16105 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16106 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16107 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16108 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16109 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16110 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16111 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16112 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16113 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16114 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16115 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16116 | |
| 16117 | spec->adc_nids = alc861_adc_nids; |
| 16118 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16119 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16120 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16121 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16122 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16123 | return 1; |
| 16124 | } |
| 16125 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16126 | /* additional initialization for auto-configuration model */ |
| 16127 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16128 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16129 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16130 | alc861_auto_init_multi_out(codec); |
| 16131 | alc861_auto_init_hp_out(codec); |
| 16132 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16133 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16134 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16135 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16136 | } |
| 16137 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16138 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16139 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16140 | { 0x15, HDA_INPUT, 0 }, |
| 16141 | { 0x15, HDA_INPUT, 1 }, |
| 16142 | { 0x15, HDA_INPUT, 2 }, |
| 16143 | { 0x15, HDA_INPUT, 3 }, |
| 16144 | { } /* end */ |
| 16145 | }; |
| 16146 | #endif |
| 16147 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16148 | |
| 16149 | /* |
| 16150 | * configuration and preset |
| 16151 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16152 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 16153 | [ALC861_3ST] = "3stack", |
| 16154 | [ALC660_3ST] = "3stack-660", |
| 16155 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16156 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16157 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16158 | [ALC861_TOSHIBA] = "toshiba", |
| 16159 | [ALC861_ASUS] = "asus", |
| 16160 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16161 | [ALC861_AUTO] = "auto", |
| 16162 | }; |
| 16163 | |
| 16164 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16165 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16166 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16167 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16168 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16169 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16170 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16171 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16172 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16173 | * Any other models that need this preset? |
| 16174 | */ |
| 16175 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16176 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16177 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16178 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16179 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16180 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16181 | /* FIXME: the below seems conflict */ |
| 16182 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16183 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16184 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16185 | {} |
| 16186 | }; |
| 16187 | |
| 16188 | static struct alc_config_preset alc861_presets[] = { |
| 16189 | [ALC861_3ST] = { |
| 16190 | .mixers = { alc861_3ST_mixer }, |
| 16191 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16192 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16193 | .dac_nids = alc861_dac_nids, |
| 16194 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16195 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16196 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16197 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16198 | .adc_nids = alc861_adc_nids, |
| 16199 | .input_mux = &alc861_capture_source, |
| 16200 | }, |
| 16201 | [ALC861_3ST_DIG] = { |
| 16202 | .mixers = { alc861_base_mixer }, |
| 16203 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16204 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16205 | .dac_nids = alc861_dac_nids, |
| 16206 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16207 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16208 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16209 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16210 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16211 | .adc_nids = alc861_adc_nids, |
| 16212 | .input_mux = &alc861_capture_source, |
| 16213 | }, |
| 16214 | [ALC861_6ST_DIG] = { |
| 16215 | .mixers = { alc861_base_mixer }, |
| 16216 | .init_verbs = { alc861_base_init_verbs }, |
| 16217 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16218 | .dac_nids = alc861_dac_nids, |
| 16219 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16220 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16221 | .channel_mode = alc861_8ch_modes, |
| 16222 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16223 | .adc_nids = alc861_adc_nids, |
| 16224 | .input_mux = &alc861_capture_source, |
| 16225 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16226 | [ALC660_3ST] = { |
| 16227 | .mixers = { alc861_3ST_mixer }, |
| 16228 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16229 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16230 | .dac_nids = alc660_dac_nids, |
| 16231 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16232 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16233 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16234 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16235 | .adc_nids = alc861_adc_nids, |
| 16236 | .input_mux = &alc861_capture_source, |
| 16237 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16238 | [ALC861_UNIWILL_M31] = { |
| 16239 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16240 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16241 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16242 | .dac_nids = alc861_dac_nids, |
| 16243 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16244 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16245 | .channel_mode = alc861_uniwill_m31_modes, |
| 16246 | .need_dac_fix = 1, |
| 16247 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16248 | .adc_nids = alc861_adc_nids, |
| 16249 | .input_mux = &alc861_capture_source, |
| 16250 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16251 | [ALC861_TOSHIBA] = { |
| 16252 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16253 | .init_verbs = { alc861_base_init_verbs, |
| 16254 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16255 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16256 | .dac_nids = alc861_dac_nids, |
| 16257 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16258 | .channel_mode = alc883_3ST_2ch_modes, |
| 16259 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16260 | .adc_nids = alc861_adc_nids, |
| 16261 | .input_mux = &alc861_capture_source, |
| 16262 | .unsol_event = alc861_toshiba_unsol_event, |
| 16263 | .init_hook = alc861_toshiba_automute, |
| 16264 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16265 | [ALC861_ASUS] = { |
| 16266 | .mixers = { alc861_asus_mixer }, |
| 16267 | .init_verbs = { alc861_asus_init_verbs }, |
| 16268 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16269 | .dac_nids = alc861_dac_nids, |
| 16270 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16271 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16272 | .channel_mode = alc861_asus_modes, |
| 16273 | .need_dac_fix = 1, |
| 16274 | .hp_nid = 0x06, |
| 16275 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16276 | .adc_nids = alc861_adc_nids, |
| 16277 | .input_mux = &alc861_capture_source, |
| 16278 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16279 | [ALC861_ASUS_LAPTOP] = { |
| 16280 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16281 | .init_verbs = { alc861_asus_init_verbs, |
| 16282 | alc861_asus_laptop_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(alc883_3ST_2ch_modes), |
| 16287 | .channel_mode = alc883_3ST_2ch_modes, |
| 16288 | .need_dac_fix = 1, |
| 16289 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16290 | .adc_nids = alc861_adc_nids, |
| 16291 | .input_mux = &alc861_capture_source, |
| 16292 | }, |
| 16293 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16294 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16295 | /* Pin config fixes */ |
| 16296 | enum { |
| 16297 | PINFIX_FSC_AMILO_PI1505, |
| 16298 | }; |
| 16299 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16300 | static const struct alc_fixup alc861_fixups[] = { |
| 16301 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16302 | .pins = (const struct alc_pincfg[]) { |
| 16303 | { 0x0b, 0x0221101f }, /* HP */ |
| 16304 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16305 | { } |
| 16306 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16307 | }, |
| 16308 | }; |
| 16309 | |
| 16310 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16311 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16312 | {} |
| 16313 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16314 | |
| 16315 | static int patch_alc861(struct hda_codec *codec) |
| 16316 | { |
| 16317 | struct alc_spec *spec; |
| 16318 | int board_config; |
| 16319 | int err; |
| 16320 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16321 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16322 | if (spec == NULL) |
| 16323 | return -ENOMEM; |
| 16324 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16325 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16326 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16327 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16328 | alc861_models, |
| 16329 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16330 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16331 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16332 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16333 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16334 | board_config = ALC861_AUTO; |
| 16335 | } |
| 16336 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16337 | if (board_config == ALC861_AUTO) |
| 16338 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16339 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16340 | if (board_config == ALC861_AUTO) { |
| 16341 | /* automatic parse from the BIOS config */ |
| 16342 | err = alc861_parse_auto_config(codec); |
| 16343 | if (err < 0) { |
| 16344 | alc_free(codec); |
| 16345 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16346 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16347 | printk(KERN_INFO |
| 16348 | "hda_codec: Cannot set up configuration " |
| 16349 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16350 | board_config = ALC861_3ST_DIG; |
| 16351 | } |
| 16352 | } |
| 16353 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16354 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16355 | if (err < 0) { |
| 16356 | alc_free(codec); |
| 16357 | return err; |
| 16358 | } |
| 16359 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16360 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16361 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16362 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16363 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16364 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16365 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16366 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16367 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16368 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16369 | if (!spec->cap_mixer) |
| 16370 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16371 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16372 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16373 | spec->vmaster_nid = 0x03; |
| 16374 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16375 | if (board_config == ALC861_AUTO) |
| 16376 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 16377 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16378 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16379 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16380 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16381 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16382 | spec->power_hook = alc_power_eapd; |
| 16383 | #endif |
| 16384 | } |
| 16385 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16386 | if (!spec->loopback.amplist) |
| 16387 | spec->loopback.amplist = alc861_loopbacks; |
| 16388 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16389 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16390 | return 0; |
| 16391 | } |
| 16392 | |
| 16393 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16394 | * ALC861-VD support |
| 16395 | * |
| 16396 | * Based on ALC882 |
| 16397 | * |
| 16398 | * In addition, an independent DAC |
| 16399 | */ |
| 16400 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16401 | |
| 16402 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16403 | /* front, surr, clfe, side surr */ |
| 16404 | 0x02, 0x03, 0x04, 0x05 |
| 16405 | }; |
| 16406 | |
| 16407 | /* dac_nids for ALC660vd are in a different order - according to |
| 16408 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16409 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16410 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16411 | * - and it is the same as in 861vd. |
| 16412 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16413 | */ |
| 16414 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16415 | /* front, rear, clfe, rear_surr */ |
| 16416 | 0x02, 0x04, 0x03 |
| 16417 | }; |
| 16418 | |
| 16419 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16420 | /* ADC0 */ |
| 16421 | 0x09, |
| 16422 | }; |
| 16423 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16424 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16425 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16426 | /* input MUX */ |
| 16427 | /* FIXME: should be a matrix-type input source selection */ |
| 16428 | static struct hda_input_mux alc861vd_capture_source = { |
| 16429 | .num_items = 4, |
| 16430 | .items = { |
| 16431 | { "Mic", 0x0 }, |
| 16432 | { "Front Mic", 0x1 }, |
| 16433 | { "Line", 0x2 }, |
| 16434 | { "CD", 0x4 }, |
| 16435 | }, |
| 16436 | }; |
| 16437 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16438 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16439 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16440 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16441 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16442 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16443 | }, |
| 16444 | }; |
| 16445 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16446 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16447 | .num_items = 2, |
| 16448 | .items = { |
| 16449 | { "Front Mic", 0x0 }, |
| 16450 | { "ATAPI Mic", 0x1 }, |
| 16451 | }, |
| 16452 | }; |
| 16453 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16454 | /* |
| 16455 | * 2ch mode |
| 16456 | */ |
| 16457 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16458 | { 2, NULL } |
| 16459 | }; |
| 16460 | |
| 16461 | /* |
| 16462 | * 6ch mode |
| 16463 | */ |
| 16464 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16465 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16466 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16467 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16468 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16469 | { } /* end */ |
| 16470 | }; |
| 16471 | |
| 16472 | /* |
| 16473 | * 8ch mode |
| 16474 | */ |
| 16475 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16476 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16477 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16478 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16479 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16480 | { } /* end */ |
| 16481 | }; |
| 16482 | |
| 16483 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16484 | { 6, alc861vd_6stack_ch6_init }, |
| 16485 | { 8, alc861vd_6stack_ch8_init }, |
| 16486 | }; |
| 16487 | |
| 16488 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16489 | { |
| 16490 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16491 | .name = "Channel Mode", |
| 16492 | .info = alc_ch_mode_info, |
| 16493 | .get = alc_ch_mode_get, |
| 16494 | .put = alc_ch_mode_put, |
| 16495 | }, |
| 16496 | { } /* end */ |
| 16497 | }; |
| 16498 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16499 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16500 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16501 | */ |
| 16502 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16503 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16504 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16505 | |
| 16506 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16507 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16508 | |
| 16509 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16510 | HDA_OUTPUT), |
| 16511 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16512 | HDA_OUTPUT), |
| 16513 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16514 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16515 | |
| 16516 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16517 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16518 | |
| 16519 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16520 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16521 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16522 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16523 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16524 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16525 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16526 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16527 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16528 | |
| 16529 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16530 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16531 | |
| 16532 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16533 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16534 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16535 | { } /* end */ |
| 16536 | }; |
| 16537 | |
| 16538 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16539 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16540 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16541 | |
| 16542 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16543 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16544 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16546 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16547 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16548 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16549 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16550 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16551 | |
| 16552 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16553 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16554 | |
| 16555 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16556 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16557 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16558 | { } /* end */ |
| 16559 | }; |
| 16560 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16561 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16562 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16563 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16564 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16565 | |
| 16566 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16567 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16568 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16569 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16570 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16571 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16572 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16573 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16574 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16575 | |
| 16576 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16577 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16578 | |
| 16579 | { } /* end */ |
| 16580 | }; |
| 16581 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16582 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16583 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16584 | */ |
| 16585 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16586 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16587 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16588 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16589 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16590 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16591 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16592 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16593 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16594 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16595 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16596 | { } /* end */ |
| 16597 | }; |
| 16598 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16599 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16600 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16601 | */ |
| 16602 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16603 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16604 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16605 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16606 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16607 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16608 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16609 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16610 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16611 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16612 | { } /* end */ |
| 16613 | }; |
| 16614 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16615 | /* |
| 16616 | * generic initialization of ADC, input mixers and output mixers |
| 16617 | */ |
| 16618 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16619 | /* |
| 16620 | * Unmute ADC0 and set the default input to mic-in |
| 16621 | */ |
| 16622 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16623 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16624 | |
| 16625 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16626 | * the analog-loopback mixer widget |
| 16627 | */ |
| 16628 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16629 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16630 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16631 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16632 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16633 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16634 | |
| 16635 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16636 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16637 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16638 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16639 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16640 | |
| 16641 | /* |
| 16642 | * Set up output mixers (0x02 - 0x05) |
| 16643 | */ |
| 16644 | /* set vol=0 to output mixers */ |
| 16645 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16646 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16647 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16648 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16649 | |
| 16650 | /* set up input amps for analog loopback */ |
| 16651 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16652 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16653 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16654 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16655 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16656 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16657 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16658 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16659 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16660 | |
| 16661 | { } |
| 16662 | }; |
| 16663 | |
| 16664 | /* |
| 16665 | * 3-stack pin configuration: |
| 16666 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16667 | */ |
| 16668 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16669 | /* |
| 16670 | * Set pin mode and muting |
| 16671 | */ |
| 16672 | /* set front pin widgets 0x14 for output */ |
| 16673 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16674 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16675 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16676 | |
| 16677 | /* Mic (rear) pin: input vref at 80% */ |
| 16678 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16679 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16680 | /* Front Mic pin: input vref at 80% */ |
| 16681 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16682 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16683 | /* Line In pin: input */ |
| 16684 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16685 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16686 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16687 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16688 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16689 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16690 | /* CD pin widget for input */ |
| 16691 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16692 | |
| 16693 | { } |
| 16694 | }; |
| 16695 | |
| 16696 | /* |
| 16697 | * 6-stack pin configuration: |
| 16698 | */ |
| 16699 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16700 | /* |
| 16701 | * Set pin mode and muting |
| 16702 | */ |
| 16703 | /* set front pin widgets 0x14 for output */ |
| 16704 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16705 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16706 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16707 | |
| 16708 | /* Rear Pin: output 1 (0x0d) */ |
| 16709 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16710 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16711 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16712 | /* CLFE Pin: output 2 (0x0e) */ |
| 16713 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16714 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16715 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16716 | /* Side Pin: output 3 (0x0f) */ |
| 16717 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16718 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16719 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16720 | |
| 16721 | /* Mic (rear) pin: input vref at 80% */ |
| 16722 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16723 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16724 | /* Front Mic pin: input vref at 80% */ |
| 16725 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16726 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16727 | /* Line In pin: input */ |
| 16728 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16729 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16730 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16731 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16732 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16733 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16734 | /* CD pin widget for input */ |
| 16735 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16736 | |
| 16737 | { } |
| 16738 | }; |
| 16739 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16740 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16741 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16742 | { } |
| 16743 | }; |
| 16744 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16745 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16746 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16747 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16748 | { } |
| 16749 | }; |
| 16750 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16751 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16752 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16753 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16754 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16755 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16756 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16757 | {} |
| 16758 | }; |
| 16759 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16760 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16761 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16762 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16763 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16764 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16765 | } |
| 16766 | |
| 16767 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16768 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16769 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16770 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16771 | } |
| 16772 | |
| 16773 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16774 | unsigned int res) |
| 16775 | { |
| 16776 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16777 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16778 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16779 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16780 | default: |
| 16781 | alc_automute_amp_unsol_event(codec, res); |
| 16782 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16783 | } |
| 16784 | } |
| 16785 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16786 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16787 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16788 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16789 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16790 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16791 | |
| 16792 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16793 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16794 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16795 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16796 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16797 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16798 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16799 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16800 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16801 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16802 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16803 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16804 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16805 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16806 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16807 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16808 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16809 | |
| 16810 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16811 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16812 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16813 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16814 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16815 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16816 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16817 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16818 | |
| 16819 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16820 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16821 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16822 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16823 | |
| 16824 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16825 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16826 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16827 | |
| 16828 | { } /* end */ |
| 16829 | }; |
| 16830 | |
| 16831 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16832 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16833 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16834 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16835 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16836 | spec->autocfg.hp_pins[0] = 0x15; |
| 16837 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16838 | } |
| 16839 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16840 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16841 | #define alc861vd_loopbacks alc880_loopbacks |
| 16842 | #endif |
| 16843 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16844 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16845 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16846 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16847 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16848 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16849 | |
| 16850 | /* |
| 16851 | * configuration and preset |
| 16852 | */ |
| 16853 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16854 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16855 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16856 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16857 | [ALC861VD_3ST] = "3stack", |
| 16858 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16859 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16860 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16861 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16862 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16863 | [ALC861VD_AUTO] = "auto", |
| 16864 | }; |
| 16865 | |
| 16866 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16867 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16868 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16869 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16870 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16871 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16872 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16873 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16874 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16875 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16876 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16877 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16878 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16879 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16880 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16881 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16882 | {} |
| 16883 | }; |
| 16884 | |
| 16885 | static struct alc_config_preset alc861vd_presets[] = { |
| 16886 | [ALC660VD_3ST] = { |
| 16887 | .mixers = { alc861vd_3st_mixer }, |
| 16888 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16889 | alc861vd_3stack_init_verbs }, |
| 16890 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16891 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16892 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16893 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16894 | .input_mux = &alc861vd_capture_source, |
| 16895 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16896 | [ALC660VD_3ST_DIG] = { |
| 16897 | .mixers = { alc861vd_3st_mixer }, |
| 16898 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16899 | alc861vd_3stack_init_verbs }, |
| 16900 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16901 | .dac_nids = alc660vd_dac_nids, |
| 16902 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16903 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16904 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16905 | .input_mux = &alc861vd_capture_source, |
| 16906 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16907 | [ALC861VD_3ST] = { |
| 16908 | .mixers = { alc861vd_3st_mixer }, |
| 16909 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16910 | alc861vd_3stack_init_verbs }, |
| 16911 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16912 | .dac_nids = alc861vd_dac_nids, |
| 16913 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16914 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16915 | .input_mux = &alc861vd_capture_source, |
| 16916 | }, |
| 16917 | [ALC861VD_3ST_DIG] = { |
| 16918 | .mixers = { alc861vd_3st_mixer }, |
| 16919 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16920 | alc861vd_3stack_init_verbs }, |
| 16921 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16922 | .dac_nids = alc861vd_dac_nids, |
| 16923 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16924 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16925 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16926 | .input_mux = &alc861vd_capture_source, |
| 16927 | }, |
| 16928 | [ALC861VD_6ST_DIG] = { |
| 16929 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16930 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16931 | alc861vd_6stack_init_verbs }, |
| 16932 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16933 | .dac_nids = alc861vd_dac_nids, |
| 16934 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16935 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16936 | .channel_mode = alc861vd_6stack_modes, |
| 16937 | .input_mux = &alc861vd_capture_source, |
| 16938 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16939 | [ALC861VD_LENOVO] = { |
| 16940 | .mixers = { alc861vd_lenovo_mixer }, |
| 16941 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16942 | alc861vd_3stack_init_verbs, |
| 16943 | alc861vd_eapd_verbs, |
| 16944 | alc861vd_lenovo_unsol_verbs }, |
| 16945 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16946 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16947 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16948 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16949 | .input_mux = &alc861vd_capture_source, |
| 16950 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16951 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16952 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16953 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16954 | [ALC861VD_DALLAS] = { |
| 16955 | .mixers = { alc861vd_dallas_mixer }, |
| 16956 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16957 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16958 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16959 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16960 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16961 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16962 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16963 | .setup = alc861vd_dallas_setup, |
| 16964 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16965 | }, |
| 16966 | [ALC861VD_HP] = { |
| 16967 | .mixers = { alc861vd_hp_mixer }, |
| 16968 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16969 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16970 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16971 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16972 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16973 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16974 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16975 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16976 | .setup = alc861vd_dallas_setup, |
| 16977 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16978 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16979 | [ALC660VD_ASUS_V1S] = { |
| 16980 | .mixers = { alc861vd_lenovo_mixer }, |
| 16981 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16982 | alc861vd_3stack_init_verbs, |
| 16983 | alc861vd_eapd_verbs, |
| 16984 | alc861vd_lenovo_unsol_verbs }, |
| 16985 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16986 | .dac_nids = alc660vd_dac_nids, |
| 16987 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16988 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16989 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16990 | .input_mux = &alc861vd_capture_source, |
| 16991 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16992 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16993 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16994 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16995 | }; |
| 16996 | |
| 16997 | /* |
| 16998 | * BIOS auto configuration |
| 16999 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17000 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 17001 | const struct auto_pin_cfg *cfg) |
| 17002 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 17003 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17004 | } |
| 17005 | |
| 17006 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17007 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17008 | hda_nid_t nid, int pin_type, int dac_idx) |
| 17009 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17010 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17011 | } |
| 17012 | |
| 17013 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 17014 | { |
| 17015 | struct alc_spec *spec = codec->spec; |
| 17016 | int i; |
| 17017 | |
| 17018 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17019 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17020 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17021 | if (nid) |
| 17022 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17023 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17024 | } |
| 17025 | } |
| 17026 | |
| 17027 | |
| 17028 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 17029 | { |
| 17030 | struct alc_spec *spec = codec->spec; |
| 17031 | hda_nid_t pin; |
| 17032 | |
| 17033 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17034 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17035 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17036 | pin = spec->autocfg.speaker_pins[0]; |
| 17037 | if (pin) |
| 17038 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17039 | } |
| 17040 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17041 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 17042 | |
| 17043 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 17044 | { |
| 17045 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17046 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17047 | int i; |
| 17048 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17049 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17050 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17051 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17052 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17053 | if (nid != ALC861VD_PIN_CD_NID && |
| 17054 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17055 | snd_hda_codec_write(codec, nid, 0, |
| 17056 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17057 | AMP_OUT_MUTE); |
| 17058 | } |
| 17059 | } |
| 17060 | } |
| 17061 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17062 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17063 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17064 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17065 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17066 | |
| 17067 | /* add playback controls from the parsed DAC table */ |
| 17068 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17069 | * different NIDs for mute/unmute switch and volume control */ |
| 17070 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17071 | const struct auto_pin_cfg *cfg) |
| 17072 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17073 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17074 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17075 | hda_nid_t nid_v, nid_s; |
| 17076 | int i, err; |
| 17077 | |
| 17078 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17079 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17080 | continue; |
| 17081 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17082 | alc880_dac_to_idx( |
| 17083 | spec->multiout.dac_nids[i])); |
| 17084 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17085 | alc880_dac_to_idx( |
| 17086 | spec->multiout.dac_nids[i])); |
| 17087 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17088 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17089 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17090 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17091 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17092 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17093 | HDA_OUTPUT)); |
| 17094 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17095 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17096 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17097 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17098 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17099 | HDA_OUTPUT)); |
| 17100 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17101 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17102 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17103 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17104 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17105 | HDA_INPUT)); |
| 17106 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17107 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17108 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17109 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17110 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17111 | HDA_INPUT)); |
| 17112 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17113 | return err; |
| 17114 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17115 | const char *name = pfx; |
| 17116 | if (!name) |
| 17117 | name = chname[i]; |
| 17118 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17119 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17120 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17121 | HDA_OUTPUT)); |
| 17122 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17123 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17124 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17125 | name, i, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17126 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17127 | HDA_INPUT)); |
| 17128 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17129 | return err; |
| 17130 | } |
| 17131 | } |
| 17132 | return 0; |
| 17133 | } |
| 17134 | |
| 17135 | /* add playback controls for speaker and HP outputs */ |
| 17136 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17137 | * different NIDs for mute/unmute switch and volume control */ |
| 17138 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17139 | hda_nid_t pin, const char *pfx) |
| 17140 | { |
| 17141 | hda_nid_t nid_v, nid_s; |
| 17142 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17143 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17144 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17145 | return 0; |
| 17146 | |
| 17147 | if (alc880_is_fixed_pin(pin)) { |
| 17148 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17149 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17150 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17151 | spec->multiout.hp_nid = nid_v; |
| 17152 | else |
| 17153 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17154 | /* control HP volume/switch on the output mixer amp */ |
| 17155 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17156 | alc880_fixed_pin_idx(pin)); |
| 17157 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17158 | alc880_fixed_pin_idx(pin)); |
| 17159 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17160 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17161 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17162 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17163 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17164 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17165 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17166 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17167 | return err; |
| 17168 | } else if (alc880_is_multi_pin(pin)) { |
| 17169 | /* set manual connection */ |
| 17170 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17171 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17172 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17173 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17174 | return err; |
| 17175 | } |
| 17176 | return 0; |
| 17177 | } |
| 17178 | |
| 17179 | /* parse the BIOS configuration and set up the alc_spec |
| 17180 | * return 1 if successful, 0 if the proper config is not found, |
| 17181 | * or a negative error code |
| 17182 | * Based on ALC880 version - had to change it to override |
| 17183 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17184 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17185 | { |
| 17186 | struct alc_spec *spec = codec->spec; |
| 17187 | int err; |
| 17188 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17189 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17190 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17191 | alc861vd_ignore); |
| 17192 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17193 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17194 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17195 | return 0; /* can't find valid BIOS pin config */ |
| 17196 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17197 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17198 | if (err < 0) |
| 17199 | return err; |
| 17200 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17201 | if (err < 0) |
| 17202 | return err; |
| 17203 | err = alc861vd_auto_create_extra_out(spec, |
| 17204 | spec->autocfg.speaker_pins[0], |
| 17205 | "Speaker"); |
| 17206 | if (err < 0) |
| 17207 | return err; |
| 17208 | err = alc861vd_auto_create_extra_out(spec, |
| 17209 | spec->autocfg.hp_pins[0], |
| 17210 | "Headphone"); |
| 17211 | if (err < 0) |
| 17212 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17213 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17214 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17215 | return err; |
| 17216 | |
| 17217 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17218 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17219 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17220 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17221 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17222 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17223 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17224 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17225 | |
| 17226 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17227 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17228 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17229 | err = alc_auto_add_mic_boost(codec); |
| 17230 | if (err < 0) |
| 17231 | return err; |
| 17232 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17233 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17234 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17235 | return 1; |
| 17236 | } |
| 17237 | |
| 17238 | /* additional initialization for auto-configuration model */ |
| 17239 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17240 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17241 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17242 | alc861vd_auto_init_multi_out(codec); |
| 17243 | alc861vd_auto_init_hp_out(codec); |
| 17244 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17245 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17246 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17247 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17248 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17249 | } |
| 17250 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17251 | enum { |
| 17252 | ALC660VD_FIX_ASUS_GPIO1 |
| 17253 | }; |
| 17254 | |
| 17255 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17256 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17257 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17258 | .verbs = (const struct hda_verb[]) { |
| 17259 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17260 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17261 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17262 | { } |
| 17263 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17264 | }, |
| 17265 | }; |
| 17266 | |
| 17267 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17268 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17269 | {} |
| 17270 | }; |
| 17271 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17272 | static int patch_alc861vd(struct hda_codec *codec) |
| 17273 | { |
| 17274 | struct alc_spec *spec; |
| 17275 | int err, board_config; |
| 17276 | |
| 17277 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17278 | if (spec == NULL) |
| 17279 | return -ENOMEM; |
| 17280 | |
| 17281 | codec->spec = spec; |
| 17282 | |
| 17283 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17284 | alc861vd_models, |
| 17285 | alc861vd_cfg_tbl); |
| 17286 | |
| 17287 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17288 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17289 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17290 | board_config = ALC861VD_AUTO; |
| 17291 | } |
| 17292 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17293 | if (board_config == ALC861VD_AUTO) |
| 17294 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17295 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17296 | if (board_config == ALC861VD_AUTO) { |
| 17297 | /* automatic parse from the BIOS config */ |
| 17298 | err = alc861vd_parse_auto_config(codec); |
| 17299 | if (err < 0) { |
| 17300 | alc_free(codec); |
| 17301 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17302 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17303 | printk(KERN_INFO |
| 17304 | "hda_codec: Cannot set up configuration " |
| 17305 | "from BIOS. Using base mode...\n"); |
| 17306 | board_config = ALC861VD_3ST; |
| 17307 | } |
| 17308 | } |
| 17309 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17310 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17311 | if (err < 0) { |
| 17312 | alc_free(codec); |
| 17313 | return err; |
| 17314 | } |
| 17315 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17316 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17317 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17318 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17319 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17320 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17321 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17322 | } |
| 17323 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17324 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17325 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17326 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17327 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17328 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17329 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17330 | if (!spec->adc_nids) { |
| 17331 | spec->adc_nids = alc861vd_adc_nids; |
| 17332 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17333 | } |
| 17334 | if (!spec->capsrc_nids) |
| 17335 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17336 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17337 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17338 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17339 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17340 | spec->vmaster_nid = 0x02; |
| 17341 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17342 | if (board_config == ALC861VD_AUTO) |
| 17343 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 17344 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17345 | codec->patch_ops = alc_patch_ops; |
| 17346 | |
| 17347 | if (board_config == ALC861VD_AUTO) |
| 17348 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17349 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17350 | if (!spec->loopback.amplist) |
| 17351 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17352 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17353 | |
| 17354 | return 0; |
| 17355 | } |
| 17356 | |
| 17357 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17358 | * ALC662 support |
| 17359 | * |
| 17360 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17361 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17362 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17363 | * 6-channel independent captures. |
| 17364 | * |
| 17365 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17366 | * driver yet). |
| 17367 | */ |
| 17368 | #define ALC662_DIGOUT_NID 0x06 |
| 17369 | #define ALC662_DIGIN_NID 0x0a |
| 17370 | |
| 17371 | static hda_nid_t alc662_dac_nids[4] = { |
| 17372 | /* front, rear, clfe, rear_surr */ |
| 17373 | 0x02, 0x03, 0x04 |
| 17374 | }; |
| 17375 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17376 | static hda_nid_t alc272_dac_nids[2] = { |
| 17377 | 0x02, 0x03 |
| 17378 | }; |
| 17379 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17380 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17381 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17382 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17383 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17384 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17385 | static hda_nid_t alc272_adc_nids[1] = { |
| 17386 | /* ADC1-2 */ |
| 17387 | 0x08, |
| 17388 | }; |
| 17389 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17390 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17391 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17392 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17393 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17394 | /* input MUX */ |
| 17395 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17396 | static struct hda_input_mux alc662_capture_source = { |
| 17397 | .num_items = 4, |
| 17398 | .items = { |
| 17399 | { "Mic", 0x0 }, |
| 17400 | { "Front Mic", 0x1 }, |
| 17401 | { "Line", 0x2 }, |
| 17402 | { "CD", 0x4 }, |
| 17403 | }, |
| 17404 | }; |
| 17405 | |
| 17406 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17407 | .num_items = 2, |
| 17408 | .items = { |
| 17409 | { "Mic", 0x1 }, |
| 17410 | { "Line", 0x2 }, |
| 17411 | }, |
| 17412 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17413 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17414 | static struct hda_input_mux alc663_capture_source = { |
| 17415 | .num_items = 3, |
| 17416 | .items = { |
| 17417 | { "Mic", 0x0 }, |
| 17418 | { "Front Mic", 0x1 }, |
| 17419 | { "Line", 0x2 }, |
| 17420 | }, |
| 17421 | }; |
| 17422 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17423 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17424 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17425 | .num_items = 16, |
| 17426 | .items = { |
| 17427 | { "Autoselect Mic", 0x0 }, |
| 17428 | { "Internal Mic", 0x1 }, |
| 17429 | { "In-0x02", 0x2 }, |
| 17430 | { "In-0x03", 0x3 }, |
| 17431 | { "In-0x04", 0x4 }, |
| 17432 | { "In-0x05", 0x5 }, |
| 17433 | { "In-0x06", 0x6 }, |
| 17434 | { "In-0x07", 0x7 }, |
| 17435 | { "In-0x08", 0x8 }, |
| 17436 | { "In-0x09", 0x9 }, |
| 17437 | { "In-0x0a", 0x0a }, |
| 17438 | { "In-0x0b", 0x0b }, |
| 17439 | { "In-0x0c", 0x0c }, |
| 17440 | { "In-0x0d", 0x0d }, |
| 17441 | { "In-0x0e", 0x0e }, |
| 17442 | { "In-0x0f", 0x0f }, |
| 17443 | }, |
| 17444 | }; |
| 17445 | #endif |
| 17446 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17447 | /* |
| 17448 | * 2ch mode |
| 17449 | */ |
| 17450 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17451 | { 2, NULL } |
| 17452 | }; |
| 17453 | |
| 17454 | /* |
| 17455 | * 2ch mode |
| 17456 | */ |
| 17457 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17458 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17459 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17460 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17461 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17462 | { } /* end */ |
| 17463 | }; |
| 17464 | |
| 17465 | /* |
| 17466 | * 6ch mode |
| 17467 | */ |
| 17468 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17469 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17470 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17471 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17472 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17473 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17474 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17475 | { } /* end */ |
| 17476 | }; |
| 17477 | |
| 17478 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17479 | { 2, alc662_3ST_ch2_init }, |
| 17480 | { 6, alc662_3ST_ch6_init }, |
| 17481 | }; |
| 17482 | |
| 17483 | /* |
| 17484 | * 2ch mode |
| 17485 | */ |
| 17486 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17487 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17488 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17489 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17490 | { } /* end */ |
| 17491 | }; |
| 17492 | |
| 17493 | /* |
| 17494 | * 6ch mode |
| 17495 | */ |
| 17496 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17497 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17498 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17499 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17500 | { } /* end */ |
| 17501 | }; |
| 17502 | |
| 17503 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17504 | { 2, alc662_sixstack_ch6_init }, |
| 17505 | { 6, alc662_sixstack_ch8_init }, |
| 17506 | }; |
| 17507 | |
| 17508 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17509 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17510 | */ |
| 17511 | |
| 17512 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17513 | /* output mixer control */ |
| 17514 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17515 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17516 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17517 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17518 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17519 | 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] | 17520 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17521 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17522 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17523 | |
| 17524 | /*Input mixer control */ |
| 17525 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17526 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17527 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17528 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17530 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17531 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17532 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17533 | { } /* end */ |
| 17534 | }; |
| 17535 | |
| 17536 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17538 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17539 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17540 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17541 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17542 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17543 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17544 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17545 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17546 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17547 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17548 | { } /* end */ |
| 17549 | }; |
| 17550 | |
| 17551 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17552 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17553 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17554 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17555 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17556 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17557 | 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] | 17558 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17559 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17560 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17561 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17562 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17563 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17564 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17565 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17566 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17567 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17568 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17569 | { } /* end */ |
| 17570 | }; |
| 17571 | |
| 17572 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17573 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17574 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17575 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17576 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17577 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17578 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17579 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17580 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17581 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17582 | { } /* end */ |
| 17583 | }; |
| 17584 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17585 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17586 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17587 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17588 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17589 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17590 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17591 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17592 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17593 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17594 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17595 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17596 | { } /* end */ |
| 17597 | }; |
| 17598 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17599 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17600 | ALC262_HIPPO_MASTER_SWITCH, |
| 17601 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17602 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17603 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17604 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17605 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17606 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17607 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17608 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17609 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17610 | { } /* end */ |
| 17611 | }; |
| 17612 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17613 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17614 | .ops = &snd_hda_bind_vol, |
| 17615 | .values = { |
| 17616 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17617 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17618 | 0 |
| 17619 | }, |
| 17620 | }; |
| 17621 | |
| 17622 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17623 | .ops = &snd_hda_bind_sw, |
| 17624 | .values = { |
| 17625 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17626 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17627 | 0 |
| 17628 | }, |
| 17629 | }; |
| 17630 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17631 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17632 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17633 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17634 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17635 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17636 | { } /* end */ |
| 17637 | }; |
| 17638 | |
| 17639 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17640 | .ops = &snd_hda_bind_sw, |
| 17641 | .values = { |
| 17642 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17643 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17644 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17645 | 0 |
| 17646 | }, |
| 17647 | }; |
| 17648 | |
| 17649 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17650 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17651 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17652 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17653 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17654 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17655 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17656 | |
| 17657 | { } /* end */ |
| 17658 | }; |
| 17659 | |
| 17660 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17661 | .ops = &snd_hda_bind_sw, |
| 17662 | .values = { |
| 17663 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17664 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17665 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17666 | 0 |
| 17667 | }, |
| 17668 | }; |
| 17669 | |
| 17670 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17671 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17672 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17673 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17674 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17675 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17676 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17677 | { } /* end */ |
| 17678 | }; |
| 17679 | |
| 17680 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17681 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17682 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17683 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17684 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17685 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17686 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17687 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17688 | { } /* end */ |
| 17689 | }; |
| 17690 | |
| 17691 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17692 | .ops = &snd_hda_bind_vol, |
| 17693 | .values = { |
| 17694 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17695 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17696 | 0 |
| 17697 | }, |
| 17698 | }; |
| 17699 | |
| 17700 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17701 | .ops = &snd_hda_bind_sw, |
| 17702 | .values = { |
| 17703 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17704 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17705 | 0 |
| 17706 | }, |
| 17707 | }; |
| 17708 | |
| 17709 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17710 | HDA_BIND_VOL("Master Playback Volume", |
| 17711 | &alc663_asus_two_bind_master_vol), |
| 17712 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17713 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17714 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17715 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17716 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17717 | { } /* end */ |
| 17718 | }; |
| 17719 | |
| 17720 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17721 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17722 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17723 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17724 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17725 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17726 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17727 | { } /* end */ |
| 17728 | }; |
| 17729 | |
| 17730 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17731 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17732 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17733 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17734 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17735 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17736 | |
| 17737 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17738 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17739 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17740 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17741 | { } /* end */ |
| 17742 | }; |
| 17743 | |
| 17744 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17745 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17746 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17747 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17748 | |
| 17749 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17750 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17751 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17752 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17753 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17754 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17755 | { } /* end */ |
| 17756 | }; |
| 17757 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17758 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17759 | .ops = &snd_hda_bind_sw, |
| 17760 | .values = { |
| 17761 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17762 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17763 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17764 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17765 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17766 | 0 |
| 17767 | }, |
| 17768 | }; |
| 17769 | |
| 17770 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17771 | .ops = &snd_hda_bind_sw, |
| 17772 | .values = { |
| 17773 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17774 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17775 | 0 |
| 17776 | }, |
| 17777 | }; |
| 17778 | |
| 17779 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17780 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17781 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17782 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17783 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17784 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17785 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17786 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17787 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17788 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17789 | { } /* end */ |
| 17790 | }; |
| 17791 | |
| 17792 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17793 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17794 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17795 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17796 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17797 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17800 | { } /* end */ |
| 17801 | }; |
| 17802 | |
| 17803 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17804 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17805 | { |
| 17806 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17807 | .name = "Channel Mode", |
| 17808 | .info = alc_ch_mode_info, |
| 17809 | .get = alc_ch_mode_get, |
| 17810 | .put = alc_ch_mode_put, |
| 17811 | }, |
| 17812 | { } /* end */ |
| 17813 | }; |
| 17814 | |
| 17815 | static struct hda_verb alc662_init_verbs[] = { |
| 17816 | /* ADC: mute amp left and right */ |
| 17817 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17818 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17819 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17820 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17821 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17822 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17823 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17824 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17825 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17826 | |
| 17827 | /* Front Pin: output 0 (0x0c) */ |
| 17828 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17829 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17830 | |
| 17831 | /* Rear Pin: output 1 (0x0d) */ |
| 17832 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17833 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17834 | |
| 17835 | /* CLFE Pin: output 2 (0x0e) */ |
| 17836 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17837 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17838 | |
| 17839 | /* Mic (rear) pin: input vref at 80% */ |
| 17840 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17841 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17842 | /* Front Mic pin: input vref at 80% */ |
| 17843 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17844 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17845 | /* Line In pin: input */ |
| 17846 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17847 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17848 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17849 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17850 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17851 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17852 | /* CD pin widget for input */ |
| 17853 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17854 | |
| 17855 | /* FIXME: use matrix-type input source selection */ |
| 17856 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17857 | /* Input mixer */ |
| 17858 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17859 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17860 | |
| 17861 | /* always trun on EAPD */ |
| 17862 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17863 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17864 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17865 | { } |
| 17866 | }; |
| 17867 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17868 | static struct hda_verb alc663_init_verbs[] = { |
| 17869 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17870 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17871 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17872 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17873 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17874 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17875 | { } |
| 17876 | }; |
| 17877 | |
| 17878 | static struct hda_verb alc272_init_verbs[] = { |
| 17879 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17880 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17881 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17882 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17883 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17884 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17885 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17886 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17887 | { } |
| 17888 | }; |
| 17889 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17890 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17891 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17892 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17893 | {} |
| 17894 | }; |
| 17895 | |
| 17896 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17897 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17898 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17899 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17900 | }; |
| 17901 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17902 | /* Set Unsolicited Event*/ |
| 17903 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17904 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17905 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17906 | {} |
| 17907 | }; |
| 17908 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17909 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17910 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17911 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17912 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17913 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17914 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17915 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17916 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17917 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17918 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17919 | {} |
| 17920 | }; |
| 17921 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17922 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17923 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17924 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17925 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17926 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17927 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17928 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17929 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17930 | {} |
| 17931 | }; |
| 17932 | |
| 17933 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17934 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17935 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17936 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17937 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17938 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17939 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17940 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17941 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17942 | {} |
| 17943 | }; |
| 17944 | |
| 17945 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17946 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17947 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17948 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17949 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17950 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17951 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17952 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17953 | {} |
| 17954 | }; |
| 17955 | |
| 17956 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17957 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17958 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17959 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17960 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17961 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17962 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17963 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17964 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17965 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17966 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17967 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17968 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17969 | {} |
| 17970 | }; |
| 17971 | |
| 17972 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17973 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17974 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17975 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17976 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17977 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17978 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17979 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17980 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17981 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17982 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17983 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17984 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17985 | {} |
| 17986 | }; |
| 17987 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17988 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17989 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17990 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17991 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17992 | |
| 17993 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17994 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17995 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17996 | |
| 17997 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17998 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17999 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 18000 | {} |
| 18001 | }; |
| 18002 | |
| 18003 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 18004 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18005 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18006 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18007 | |
| 18008 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18009 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18010 | {} |
| 18011 | }; |
| 18012 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18013 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 18014 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 18015 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18016 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18017 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18018 | {} |
| 18019 | }; |
| 18020 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18021 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 18022 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18023 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18024 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18025 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18026 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18027 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18028 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18029 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18030 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18031 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18032 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18033 | {} |
| 18034 | }; |
| 18035 | |
| 18036 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 18037 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18038 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18039 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18040 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18041 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18042 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18043 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18044 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18045 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18046 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18047 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18048 | {} |
| 18049 | }; |
| 18050 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18051 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 18052 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18053 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18054 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18055 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18056 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18057 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18058 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18059 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18060 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18061 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18064 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18065 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18066 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18067 | {} |
| 18068 | }; |
| 18069 | |
| 18070 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 18071 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18072 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18073 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18074 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18075 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18076 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18077 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18078 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18079 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18080 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18081 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18082 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18084 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18085 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18086 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18087 | {} |
| 18088 | }; |
| 18089 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18090 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18091 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18092 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18093 | { } /* end */ |
| 18094 | }; |
| 18095 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18096 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18097 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18098 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18099 | { } /* end */ |
| 18100 | }; |
| 18101 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18102 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 18103 | { |
| 18104 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18105 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18106 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18107 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18108 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18109 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18110 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18111 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18112 | } |
| 18113 | |
| 18114 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 18115 | { |
| 18116 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18117 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18118 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18119 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18120 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18121 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18122 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18123 | HDA_AMP_MUTE, bits); |
| 18124 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18125 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18126 | } |
| 18127 | |
| 18128 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 18129 | unsigned int res) |
| 18130 | { |
| 18131 | if ((res >> 26) == ALC880_HP_EVENT) |
| 18132 | alc662_lenovo_101e_all_automute(codec); |
| 18133 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 18134 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 18135 | } |
| 18136 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18137 | /* unsolicited event for HP jack sensing */ |
| 18138 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 18139 | unsigned int res) |
| 18140 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18141 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18142 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18143 | else |
| 18144 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18145 | } |
| 18146 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18147 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18148 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18149 | struct alc_spec *spec = codec->spec; |
| 18150 | |
| 18151 | alc262_hippo1_setup(codec); |
| 18152 | spec->ext_mic.pin = 0x18; |
| 18153 | spec->ext_mic.mux_idx = 0; |
| 18154 | spec->int_mic.pin = 0x19; |
| 18155 | spec->int_mic.mux_idx = 1; |
| 18156 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18157 | } |
| 18158 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18159 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 18160 | { |
| 18161 | alc262_hippo_automute(codec); |
| 18162 | alc_mic_automute(codec); |
| 18163 | } |
| 18164 | |
| 18165 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18166 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18167 | struct alc_spec *spec = codec->spec; |
| 18168 | |
| 18169 | spec->autocfg.hp_pins[0] = 0x14; |
| 18170 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18171 | } |
| 18172 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18173 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 18174 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18175 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 18176 | { |
| 18177 | unsigned int present; |
| 18178 | unsigned char bits; |
| 18179 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18180 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18181 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18182 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18183 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18184 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18185 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18186 | } |
| 18187 | |
| 18188 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 18189 | { |
| 18190 | unsigned int present; |
| 18191 | unsigned char bits; |
| 18192 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18193 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18194 | bits = present ? HDA_AMP_MUTE : 0; |
| 18195 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18196 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18197 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18198 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18199 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18200 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18201 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18202 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18203 | } |
| 18204 | |
| 18205 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18206 | { |
| 18207 | unsigned int present; |
| 18208 | unsigned char bits; |
| 18209 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18210 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18211 | bits = present ? HDA_AMP_MUTE : 0; |
| 18212 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18213 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18214 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18215 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18216 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18217 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18218 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18219 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18220 | } |
| 18221 | |
| 18222 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18223 | { |
| 18224 | unsigned int present; |
| 18225 | unsigned char bits; |
| 18226 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18227 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18228 | bits = present ? 0 : PIN_OUT; |
| 18229 | snd_hda_codec_write(codec, 0x14, 0, |
| 18230 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18231 | } |
| 18232 | |
| 18233 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18234 | { |
| 18235 | unsigned int present1, present2; |
| 18236 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18237 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18238 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18239 | |
| 18240 | if (present1 || present2) { |
| 18241 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18242 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18243 | } else { |
| 18244 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18245 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18246 | } |
| 18247 | } |
| 18248 | |
| 18249 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18250 | { |
| 18251 | unsigned int present1, present2; |
| 18252 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18253 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18254 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18255 | |
| 18256 | if (present1 || present2) { |
| 18257 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18258 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18259 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18260 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18261 | } else { |
| 18262 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18263 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18264 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18265 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18266 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18267 | } |
| 18268 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18269 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18270 | { |
| 18271 | unsigned int present1, present2; |
| 18272 | |
| 18273 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18274 | AC_VERB_GET_PIN_SENSE, 0) |
| 18275 | & AC_PINSENSE_PRESENCE; |
| 18276 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18277 | AC_VERB_GET_PIN_SENSE, 0) |
| 18278 | & AC_PINSENSE_PRESENCE; |
| 18279 | |
| 18280 | if (present1 || present2) { |
| 18281 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18282 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18283 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18284 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18285 | } else { |
| 18286 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18287 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18288 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18289 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18290 | } |
| 18291 | } |
| 18292 | |
| 18293 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18294 | { |
| 18295 | unsigned int present1, present2; |
| 18296 | |
| 18297 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18298 | AC_VERB_GET_PIN_SENSE, 0) |
| 18299 | & AC_PINSENSE_PRESENCE; |
| 18300 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18301 | AC_VERB_GET_PIN_SENSE, 0) |
| 18302 | & AC_PINSENSE_PRESENCE; |
| 18303 | |
| 18304 | if (present1 || present2) { |
| 18305 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18306 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18307 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18308 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18309 | } else { |
| 18310 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18311 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18312 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18313 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18314 | } |
| 18315 | } |
| 18316 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18317 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18318 | unsigned int res) |
| 18319 | { |
| 18320 | switch (res >> 26) { |
| 18321 | case ALC880_HP_EVENT: |
| 18322 | alc663_m51va_speaker_automute(codec); |
| 18323 | break; |
| 18324 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18325 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18326 | break; |
| 18327 | } |
| 18328 | } |
| 18329 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18330 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18331 | { |
| 18332 | struct alc_spec *spec = codec->spec; |
| 18333 | spec->ext_mic.pin = 0x18; |
| 18334 | spec->ext_mic.mux_idx = 0; |
| 18335 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18336 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18337 | spec->auto_mic = 1; |
| 18338 | } |
| 18339 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18340 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18341 | { |
| 18342 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18343 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18344 | } |
| 18345 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18346 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18347 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18348 | |
| 18349 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18350 | { |
| 18351 | struct alc_spec *spec = codec->spec; |
| 18352 | spec->ext_mic.pin = 0x18; |
| 18353 | spec->ext_mic.mux_idx = 0; |
| 18354 | spec->int_mic.pin = 0x19; |
| 18355 | spec->int_mic.mux_idx = 1; |
| 18356 | spec->auto_mic = 1; |
| 18357 | } |
| 18358 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18359 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18360 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18361 | /* ***************** Mode2 ******************************/ |
| 18362 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18363 | unsigned int res) |
| 18364 | { |
| 18365 | switch (res >> 26) { |
| 18366 | case ALC880_HP_EVENT: |
| 18367 | alc662_f5z_speaker_automute(codec); |
| 18368 | break; |
| 18369 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18370 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18371 | break; |
| 18372 | } |
| 18373 | } |
| 18374 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18375 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18376 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18377 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18378 | { |
| 18379 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18380 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18381 | } |
| 18382 | /* ***************** Mode3 ******************************/ |
| 18383 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18384 | unsigned int res) |
| 18385 | { |
| 18386 | switch (res >> 26) { |
| 18387 | case ALC880_HP_EVENT: |
| 18388 | alc663_two_hp_m1_speaker_automute(codec); |
| 18389 | break; |
| 18390 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18391 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18392 | break; |
| 18393 | } |
| 18394 | } |
| 18395 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18396 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18397 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18398 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18399 | { |
| 18400 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18401 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18402 | } |
| 18403 | /* ***************** Mode4 ******************************/ |
| 18404 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18405 | unsigned int res) |
| 18406 | { |
| 18407 | switch (res >> 26) { |
| 18408 | case ALC880_HP_EVENT: |
| 18409 | alc663_21jd_two_speaker_automute(codec); |
| 18410 | break; |
| 18411 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18412 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18413 | break; |
| 18414 | } |
| 18415 | } |
| 18416 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18417 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18418 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18419 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18420 | { |
| 18421 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18422 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18423 | } |
| 18424 | /* ***************** Mode5 ******************************/ |
| 18425 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18426 | unsigned int res) |
| 18427 | { |
| 18428 | switch (res >> 26) { |
| 18429 | case ALC880_HP_EVENT: |
| 18430 | alc663_15jd_two_speaker_automute(codec); |
| 18431 | break; |
| 18432 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18433 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18434 | break; |
| 18435 | } |
| 18436 | } |
| 18437 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18438 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18439 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18440 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18441 | { |
| 18442 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18443 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18444 | } |
| 18445 | /* ***************** Mode6 ******************************/ |
| 18446 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18447 | unsigned int res) |
| 18448 | { |
| 18449 | switch (res >> 26) { |
| 18450 | case ALC880_HP_EVENT: |
| 18451 | alc663_two_hp_m2_speaker_automute(codec); |
| 18452 | break; |
| 18453 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18454 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18455 | break; |
| 18456 | } |
| 18457 | } |
| 18458 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18459 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18460 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18461 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18462 | { |
| 18463 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18464 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18465 | } |
| 18466 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18467 | /* ***************** Mode7 ******************************/ |
| 18468 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18469 | unsigned int res) |
| 18470 | { |
| 18471 | switch (res >> 26) { |
| 18472 | case ALC880_HP_EVENT: |
| 18473 | alc663_two_hp_m7_speaker_automute(codec); |
| 18474 | break; |
| 18475 | case ALC880_MIC_EVENT: |
| 18476 | alc_mic_automute(codec); |
| 18477 | break; |
| 18478 | } |
| 18479 | } |
| 18480 | |
| 18481 | #define alc663_mode7_setup alc663_mode1_setup |
| 18482 | |
| 18483 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18484 | { |
| 18485 | alc663_two_hp_m7_speaker_automute(codec); |
| 18486 | alc_mic_automute(codec); |
| 18487 | } |
| 18488 | |
| 18489 | /* ***************** Mode8 ******************************/ |
| 18490 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18491 | unsigned int res) |
| 18492 | { |
| 18493 | switch (res >> 26) { |
| 18494 | case ALC880_HP_EVENT: |
| 18495 | alc663_two_hp_m8_speaker_automute(codec); |
| 18496 | break; |
| 18497 | case ALC880_MIC_EVENT: |
| 18498 | alc_mic_automute(codec); |
| 18499 | break; |
| 18500 | } |
| 18501 | } |
| 18502 | |
| 18503 | #define alc663_mode8_setup alc663_m51va_setup |
| 18504 | |
| 18505 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18506 | { |
| 18507 | alc663_two_hp_m8_speaker_automute(codec); |
| 18508 | alc_mic_automute(codec); |
| 18509 | } |
| 18510 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18511 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18512 | { |
| 18513 | unsigned int present; |
| 18514 | unsigned char bits; |
| 18515 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18516 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18517 | bits = present ? HDA_AMP_MUTE : 0; |
| 18518 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18519 | HDA_AMP_MUTE, bits); |
| 18520 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18521 | HDA_AMP_MUTE, bits); |
| 18522 | } |
| 18523 | |
| 18524 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18525 | { |
| 18526 | unsigned int present; |
| 18527 | unsigned char bits; |
| 18528 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18529 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18530 | bits = present ? HDA_AMP_MUTE : 0; |
| 18531 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18532 | HDA_AMP_MUTE, bits); |
| 18533 | } |
| 18534 | |
| 18535 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18536 | unsigned int res) |
| 18537 | { |
| 18538 | switch (res >> 26) { |
| 18539 | case ALC880_HP_EVENT: |
| 18540 | alc663_g71v_hp_automute(codec); |
| 18541 | break; |
| 18542 | case ALC880_FRONT_EVENT: |
| 18543 | alc663_g71v_front_automute(codec); |
| 18544 | break; |
| 18545 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18546 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18547 | break; |
| 18548 | } |
| 18549 | } |
| 18550 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18551 | #define alc663_g71v_setup alc663_m51va_setup |
| 18552 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18553 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18554 | { |
| 18555 | alc663_g71v_front_automute(codec); |
| 18556 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18557 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18558 | } |
| 18559 | |
| 18560 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18561 | unsigned int res) |
| 18562 | { |
| 18563 | switch (res >> 26) { |
| 18564 | case ALC880_HP_EVENT: |
| 18565 | alc663_m51va_speaker_automute(codec); |
| 18566 | break; |
| 18567 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18568 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18569 | break; |
| 18570 | } |
| 18571 | } |
| 18572 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18573 | #define alc663_g50v_setup alc663_m51va_setup |
| 18574 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18575 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18576 | { |
| 18577 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18578 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18579 | } |
| 18580 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18581 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18582 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18583 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18584 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18585 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18586 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18587 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18588 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18589 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18590 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18591 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18592 | { } /* end */ |
| 18593 | }; |
| 18594 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18595 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18596 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18597 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18598 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18599 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18600 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18601 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18602 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18603 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18604 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18605 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18606 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18607 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18608 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18609 | { } /* end */ |
| 18610 | }; |
| 18611 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18612 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18613 | #define alc662_loopbacks alc880_loopbacks |
| 18614 | #endif |
| 18615 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18616 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18617 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18618 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18619 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18620 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18621 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18622 | |
| 18623 | /* |
| 18624 | * configuration and preset |
| 18625 | */ |
| 18626 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18627 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18628 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18629 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18630 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18631 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18632 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18633 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18634 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18635 | [ALC663_ASUS_M51VA] = "m51va", |
| 18636 | [ALC663_ASUS_G71V] = "g71v", |
| 18637 | [ALC663_ASUS_H13] = "h13", |
| 18638 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18639 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18640 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18641 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18642 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18643 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18644 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18645 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18646 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18647 | [ALC272_DELL] = "dell", |
| 18648 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18649 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18650 | [ALC662_AUTO] = "auto", |
| 18651 | }; |
| 18652 | |
| 18653 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18654 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18655 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18656 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18657 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18658 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18659 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18660 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18661 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18662 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18663 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18664 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18665 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18666 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18667 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18668 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18669 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18670 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18671 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18672 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18673 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18674 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18675 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18676 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18677 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18678 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18679 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18680 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18681 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18682 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18683 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18684 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18685 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18686 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18687 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18688 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18689 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18690 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18691 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18692 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18693 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18694 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18695 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18696 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18697 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18698 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18699 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18700 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18701 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18702 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18703 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18704 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18705 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18706 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18707 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18708 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18709 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18710 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18711 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18712 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18713 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18714 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18715 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18716 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18717 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18718 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18719 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18720 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18721 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18722 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18723 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18724 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18725 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18726 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18727 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18728 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18729 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18730 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18731 | {} |
| 18732 | }; |
| 18733 | |
| 18734 | static struct alc_config_preset alc662_presets[] = { |
| 18735 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18736 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18737 | .init_verbs = { alc662_init_verbs }, |
| 18738 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18739 | .dac_nids = alc662_dac_nids, |
| 18740 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18741 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18742 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18743 | .channel_mode = alc662_3ST_2ch_modes, |
| 18744 | .input_mux = &alc662_capture_source, |
| 18745 | }, |
| 18746 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18747 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18748 | .init_verbs = { alc662_init_verbs }, |
| 18749 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18750 | .dac_nids = alc662_dac_nids, |
| 18751 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18752 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18753 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18754 | .channel_mode = alc662_3ST_6ch_modes, |
| 18755 | .need_dac_fix = 1, |
| 18756 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18757 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18758 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18759 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18760 | .init_verbs = { alc662_init_verbs }, |
| 18761 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18762 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18763 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18764 | .channel_mode = alc662_3ST_6ch_modes, |
| 18765 | .need_dac_fix = 1, |
| 18766 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18767 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18768 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18769 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18770 | .init_verbs = { alc662_init_verbs }, |
| 18771 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18772 | .dac_nids = alc662_dac_nids, |
| 18773 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18774 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18775 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18776 | .channel_mode = alc662_5stack_modes, |
| 18777 | .input_mux = &alc662_capture_source, |
| 18778 | }, |
| 18779 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18780 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18781 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18782 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18783 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18784 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18785 | .channel_mode = alc662_3ST_2ch_modes, |
| 18786 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18787 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18788 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18789 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18790 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18791 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18792 | .init_verbs = { alc662_init_verbs, |
| 18793 | alc662_eeepc_sue_init_verbs }, |
| 18794 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18795 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18796 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18797 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18798 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18799 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18800 | .init_hook = alc662_eeepc_inithook, |
| 18801 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18802 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18803 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18804 | alc662_chmode_mixer }, |
| 18805 | .init_verbs = { alc662_init_verbs, |
| 18806 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18807 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18808 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18809 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18810 | .channel_mode = alc662_3ST_6ch_modes, |
| 18811 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18812 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18813 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18814 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18815 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18816 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18817 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18818 | .init_verbs = { alc662_init_verbs, |
| 18819 | alc662_ecs_init_verbs }, |
| 18820 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18821 | .dac_nids = alc662_dac_nids, |
| 18822 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18823 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18824 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18825 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18826 | .init_hook = alc662_eeepc_inithook, |
| 18827 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18828 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18829 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18830 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18831 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18832 | .dac_nids = alc662_dac_nids, |
| 18833 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18834 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18835 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18836 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18837 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18838 | .init_hook = alc663_m51va_inithook, |
| 18839 | }, |
| 18840 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18841 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18842 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18843 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18844 | .dac_nids = alc662_dac_nids, |
| 18845 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18846 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18847 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18848 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18849 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18850 | .init_hook = alc663_g71v_inithook, |
| 18851 | }, |
| 18852 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18853 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18854 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18855 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18856 | .dac_nids = alc662_dac_nids, |
| 18857 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18858 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18859 | .unsol_event = alc663_m51va_unsol_event, |
| 18860 | .init_hook = alc663_m51va_inithook, |
| 18861 | }, |
| 18862 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18863 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18864 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18865 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18866 | .dac_nids = alc662_dac_nids, |
| 18867 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18868 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18869 | .channel_mode = alc662_3ST_6ch_modes, |
| 18870 | .input_mux = &alc663_capture_source, |
| 18871 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18872 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18873 | .init_hook = alc663_g50v_inithook, |
| 18874 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18875 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18876 | .mixers = { alc663_m51va_mixer }, |
| 18877 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18878 | .init_verbs = { alc662_init_verbs, |
| 18879 | alc663_21jd_amic_init_verbs }, |
| 18880 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18881 | .hp_nid = 0x03, |
| 18882 | .dac_nids = alc662_dac_nids, |
| 18883 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18884 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18885 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18886 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18887 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18888 | .init_hook = alc663_mode1_inithook, |
| 18889 | }, |
| 18890 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18891 | .mixers = { alc662_1bjd_mixer }, |
| 18892 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18893 | .init_verbs = { alc662_init_verbs, |
| 18894 | alc662_1bjd_amic_init_verbs }, |
| 18895 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18896 | .dac_nids = alc662_dac_nids, |
| 18897 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18898 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18899 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18900 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18901 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18902 | .init_hook = alc662_mode2_inithook, |
| 18903 | }, |
| 18904 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18905 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18906 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18907 | .init_verbs = { alc662_init_verbs, |
| 18908 | alc663_two_hp_amic_m1_init_verbs }, |
| 18909 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18910 | .hp_nid = 0x03, |
| 18911 | .dac_nids = alc662_dac_nids, |
| 18912 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18913 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18914 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18915 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18916 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18917 | .init_hook = alc663_mode3_inithook, |
| 18918 | }, |
| 18919 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18920 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18921 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18922 | .init_verbs = { alc662_init_verbs, |
| 18923 | alc663_21jd_amic_init_verbs}, |
| 18924 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18925 | .hp_nid = 0x03, |
| 18926 | .dac_nids = alc662_dac_nids, |
| 18927 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18928 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18929 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18930 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18931 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18932 | .init_hook = alc663_mode4_inithook, |
| 18933 | }, |
| 18934 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18935 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18936 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18937 | .init_verbs = { alc662_init_verbs, |
| 18938 | alc663_15jd_amic_init_verbs }, |
| 18939 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18940 | .hp_nid = 0x03, |
| 18941 | .dac_nids = alc662_dac_nids, |
| 18942 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18943 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18944 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18945 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18946 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18947 | .init_hook = alc663_mode5_inithook, |
| 18948 | }, |
| 18949 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18950 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18951 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18952 | .init_verbs = { alc662_init_verbs, |
| 18953 | alc663_two_hp_amic_m2_init_verbs }, |
| 18954 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18955 | .hp_nid = 0x03, |
| 18956 | .dac_nids = alc662_dac_nids, |
| 18957 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18958 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18959 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18960 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18961 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18962 | .init_hook = alc663_mode6_inithook, |
| 18963 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18964 | [ALC663_ASUS_MODE7] = { |
| 18965 | .mixers = { alc663_mode7_mixer }, |
| 18966 | .cap_mixer = alc662_auto_capture_mixer, |
| 18967 | .init_verbs = { alc662_init_verbs, |
| 18968 | alc663_mode7_init_verbs }, |
| 18969 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18970 | .hp_nid = 0x03, |
| 18971 | .dac_nids = alc662_dac_nids, |
| 18972 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18973 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18974 | .channel_mode = alc662_3ST_2ch_modes, |
| 18975 | .unsol_event = alc663_mode7_unsol_event, |
| 18976 | .setup = alc663_mode7_setup, |
| 18977 | .init_hook = alc663_mode7_inithook, |
| 18978 | }, |
| 18979 | [ALC663_ASUS_MODE8] = { |
| 18980 | .mixers = { alc663_mode8_mixer }, |
| 18981 | .cap_mixer = alc662_auto_capture_mixer, |
| 18982 | .init_verbs = { alc662_init_verbs, |
| 18983 | alc663_mode8_init_verbs }, |
| 18984 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18985 | .hp_nid = 0x03, |
| 18986 | .dac_nids = alc662_dac_nids, |
| 18987 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18988 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18989 | .channel_mode = alc662_3ST_2ch_modes, |
| 18990 | .unsol_event = alc663_mode8_unsol_event, |
| 18991 | .setup = alc663_mode8_setup, |
| 18992 | .init_hook = alc663_mode8_inithook, |
| 18993 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18994 | [ALC272_DELL] = { |
| 18995 | .mixers = { alc663_m51va_mixer }, |
| 18996 | .cap_mixer = alc272_auto_capture_mixer, |
| 18997 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18998 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18999 | .dac_nids = alc662_dac_nids, |
| 19000 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19001 | .adc_nids = alc272_adc_nids, |
| 19002 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 19003 | .capsrc_nids = alc272_capsrc_nids, |
| 19004 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19005 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19006 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19007 | .init_hook = alc663_m51va_inithook, |
| 19008 | }, |
| 19009 | [ALC272_DELL_ZM1] = { |
| 19010 | .mixers = { alc663_m51va_mixer }, |
| 19011 | .cap_mixer = alc662_auto_capture_mixer, |
| 19012 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 19013 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19014 | .dac_nids = alc662_dac_nids, |
| 19015 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19016 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19017 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19018 | .capsrc_nids = alc662_capsrc_nids, |
| 19019 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19020 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19021 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19022 | .init_hook = alc663_m51va_inithook, |
| 19023 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19024 | [ALC272_SAMSUNG_NC10] = { |
| 19025 | .mixers = { alc272_nc10_mixer }, |
| 19026 | .init_verbs = { alc662_init_verbs, |
| 19027 | alc663_21jd_amic_init_verbs }, |
| 19028 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19029 | .dac_nids = alc272_dac_nids, |
| 19030 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19031 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19032 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19033 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19034 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19035 | .init_hook = alc663_mode4_inithook, |
| 19036 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19037 | }; |
| 19038 | |
| 19039 | |
| 19040 | /* |
| 19041 | * BIOS auto configuration |
| 19042 | */ |
| 19043 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19044 | /* convert from MIX nid to DAC */ |
| 19045 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 19046 | { |
| 19047 | if (nid == 0x0f) |
| 19048 | return 0x02; |
| 19049 | else if (nid >= 0x0c && nid <= 0x0e) |
| 19050 | return nid - 0x0c + 0x02; |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19051 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ |
| 19052 | return 0x25; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19053 | else |
| 19054 | return 0; |
| 19055 | } |
| 19056 | |
| 19057 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 19058 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 19059 | hda_nid_t dac) |
| 19060 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19061 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19062 | int i, num; |
| 19063 | |
| 19064 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 19065 | for (i = 0; i < num; i++) { |
| 19066 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 19067 | return mix[i]; |
| 19068 | } |
| 19069 | return 0; |
| 19070 | } |
| 19071 | |
| 19072 | /* look for an empty DAC slot */ |
| 19073 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 19074 | { |
| 19075 | struct alc_spec *spec = codec->spec; |
| 19076 | hda_nid_t srcs[5]; |
| 19077 | int i, j, num; |
| 19078 | |
| 19079 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 19080 | if (num < 0) |
| 19081 | return 0; |
| 19082 | for (i = 0; i < num; i++) { |
| 19083 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 19084 | if (!nid) |
| 19085 | continue; |
| 19086 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 19087 | if (spec->multiout.dac_nids[j] == nid) |
| 19088 | break; |
| 19089 | if (j >= spec->multiout.num_dacs) |
| 19090 | return nid; |
| 19091 | } |
| 19092 | return 0; |
| 19093 | } |
| 19094 | |
| 19095 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 19096 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 19097 | const struct auto_pin_cfg *cfg) |
| 19098 | { |
| 19099 | struct alc_spec *spec = codec->spec; |
| 19100 | int i; |
| 19101 | hda_nid_t dac; |
| 19102 | |
| 19103 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19104 | for (i = 0; i < cfg->line_outs; i++) { |
| 19105 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 19106 | if (!dac) |
| 19107 | continue; |
| 19108 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19109 | } |
| 19110 | return 0; |
| 19111 | } |
| 19112 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19113 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 19114 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19115 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19116 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19117 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 19118 | } |
| 19119 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19120 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 19121 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19122 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19123 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19124 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19125 | } |
| 19126 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19127 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 19128 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 19129 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 19130 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19131 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19132 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19133 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19134 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19135 | |
| 19136 | /* add playback controls from the parsed DAC table */ |
| 19137 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19138 | const struct auto_pin_cfg *cfg) |
| 19139 | { |
| 19140 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19141 | static const char *chname[4] = { |
| 19142 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19143 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19144 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19145 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19146 | int i, err; |
| 19147 | |
| 19148 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19149 | nid = spec->multiout.dac_nids[i]; |
| 19150 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19151 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19152 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 19153 | if (!mix) |
| 19154 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19155 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19156 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19157 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19158 | if (err < 0) |
| 19159 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19160 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19161 | if (err < 0) |
| 19162 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19163 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19164 | if (err < 0) |
| 19165 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19166 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19167 | if (err < 0) |
| 19168 | return err; |
| 19169 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19170 | const char *name = pfx; |
| 19171 | if (!name) |
| 19172 | name = chname[i]; |
| 19173 | err = __alc662_add_vol_ctl(spec, name, nid, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19174 | if (err < 0) |
| 19175 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19176 | err = __alc662_add_sw_ctl(spec, name, mix, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19177 | if (err < 0) |
| 19178 | return err; |
| 19179 | } |
| 19180 | } |
| 19181 | return 0; |
| 19182 | } |
| 19183 | |
| 19184 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19185 | /* return DAC nid if any new DAC is assigned */ |
| 19186 | 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] | 19187 | const char *pfx) |
| 19188 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19189 | struct alc_spec *spec = codec->spec; |
| 19190 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19191 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19192 | |
| 19193 | if (!pin) |
| 19194 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19195 | nid = alc662_look_for_dac(codec, pin); |
| 19196 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19197 | /* the corresponding DAC is already occupied */ |
| 19198 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19199 | return 0; /* no way */ |
| 19200 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19201 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19202 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19203 | } |
| 19204 | |
| 19205 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19206 | if (!mix) |
| 19207 | return 0; |
| 19208 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19209 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19210 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19211 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19212 | if (err < 0) |
| 19213 | return err; |
| 19214 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19215 | } |
| 19216 | |
| 19217 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19218 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19219 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19220 | |
| 19221 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19222 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19223 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19224 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19225 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19226 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19227 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19228 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19229 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19230 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19231 | if (num <= 1) |
| 19232 | return; |
| 19233 | for (i = 0; i < num; i++) { |
| 19234 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19235 | continue; |
| 19236 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19237 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19238 | } |
| 19239 | } |
| 19240 | |
| 19241 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19242 | { |
| 19243 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19244 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19245 | int i; |
| 19246 | |
| 19247 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19248 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19249 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19250 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19251 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19252 | } |
| 19253 | } |
| 19254 | |
| 19255 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19256 | { |
| 19257 | struct alc_spec *spec = codec->spec; |
| 19258 | hda_nid_t pin; |
| 19259 | |
| 19260 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19261 | if (pin) |
| 19262 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19263 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19264 | pin = spec->autocfg.speaker_pins[0]; |
| 19265 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19266 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19267 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19268 | } |
| 19269 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19270 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19271 | |
| 19272 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19273 | { |
| 19274 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19275 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19276 | int i; |
| 19277 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19278 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19279 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19280 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19281 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19282 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19283 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19284 | snd_hda_codec_write(codec, nid, 0, |
| 19285 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19286 | AMP_OUT_MUTE); |
| 19287 | } |
| 19288 | } |
| 19289 | } |
| 19290 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19291 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19292 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19293 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19294 | { |
| 19295 | struct alc_spec *spec = codec->spec; |
| 19296 | int err; |
| 19297 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19298 | |
| 19299 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19300 | alc662_ignore); |
| 19301 | if (err < 0) |
| 19302 | return err; |
| 19303 | if (!spec->autocfg.line_outs) |
| 19304 | return 0; /* can't find valid BIOS pin config */ |
| 19305 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19306 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19307 | if (err < 0) |
| 19308 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19309 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19310 | if (err < 0) |
| 19311 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19312 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19313 | spec->autocfg.speaker_pins[0], |
| 19314 | "Speaker"); |
| 19315 | if (err < 0) |
| 19316 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19317 | if (err) |
| 19318 | spec->multiout.extra_out_nid[0] = err; |
| 19319 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19320 | "Headphone"); |
| 19321 | if (err < 0) |
| 19322 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19323 | if (err) |
| 19324 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19325 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19326 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19327 | return err; |
| 19328 | |
| 19329 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19330 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19331 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19332 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19333 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19334 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19335 | |
| 19336 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19337 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19338 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19339 | add_verb(spec, alc662_init_verbs); |
| 19340 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19341 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19342 | add_verb(spec, alc663_init_verbs); |
| 19343 | |
| 19344 | if (codec->vendor_id == 0x10ec0272) |
| 19345 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19346 | |
| 19347 | err = alc_auto_add_mic_boost(codec); |
| 19348 | if (err < 0) |
| 19349 | return err; |
| 19350 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19351 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19352 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19353 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19354 | else |
| 19355 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19356 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19357 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19358 | } |
| 19359 | |
| 19360 | /* additional initialization for auto-configuration model */ |
| 19361 | static void alc662_auto_init(struct hda_codec *codec) |
| 19362 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19363 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19364 | alc662_auto_init_multi_out(codec); |
| 19365 | alc662_auto_init_hp_out(codec); |
| 19366 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19367 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19368 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19369 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19370 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19371 | } |
| 19372 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19373 | static void alc272_fixup_mario(struct hda_codec *codec, |
| 19374 | const struct alc_fixup *fix, int pre_init) { |
| 19375 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19376 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19377 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19378 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19379 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19380 | printk(KERN_WARNING |
| 19381 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19382 | } |
| 19383 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19384 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19385 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19386 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19387 | ALC272_FIXUP_MARIO, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19388 | }; |
| 19389 | |
| 19390 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19391 | [ALC662_FIXUP_ASPIRE] = { |
| 19392 | .pins = (const struct alc_pincfg[]) { |
| 19393 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19394 | { } |
| 19395 | } |
| 19396 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19397 | [ALC662_FIXUP_IDEAPAD] = { |
| 19398 | .pins = (const struct alc_pincfg[]) { |
| 19399 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19400 | { } |
| 19401 | } |
| 19402 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19403 | [ALC272_FIXUP_MARIO] = { |
| 19404 | .func = alc272_fixup_mario, |
| 19405 | } |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19406 | }; |
| 19407 | |
| 19408 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19409 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19410 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19411 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19412 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 19413 | {} |
| 19414 | }; |
| 19415 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19416 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19417 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19418 | {} |
| 19419 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19420 | |
| 19421 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19422 | static int patch_alc662(struct hda_codec *codec) |
| 19423 | { |
| 19424 | struct alc_spec *spec; |
| 19425 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19426 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19427 | |
| 19428 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19429 | if (!spec) |
| 19430 | return -ENOMEM; |
| 19431 | |
| 19432 | codec->spec = spec; |
| 19433 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19434 | alc_auto_parse_customize_define(codec); |
| 19435 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19436 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19437 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19438 | coef = alc_read_coef_idx(codec, 0); |
| 19439 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19440 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19441 | else if (coef & (1 << 14) && |
| 19442 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19443 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19444 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19445 | else if (coef == 0x4011) |
| 19446 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19447 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19448 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19449 | alc662_models, |
| 19450 | alc662_cfg_tbl); |
| 19451 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19452 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19453 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19454 | board_config = ALC662_AUTO; |
| 19455 | } |
| 19456 | |
| 19457 | if (board_config == ALC662_AUTO) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19458 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19459 | /* automatic parse from the BIOS config */ |
| 19460 | err = alc662_parse_auto_config(codec); |
| 19461 | if (err < 0) { |
| 19462 | alc_free(codec); |
| 19463 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19464 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19465 | printk(KERN_INFO |
| 19466 | "hda_codec: Cannot set up configuration " |
| 19467 | "from BIOS. Using base mode...\n"); |
| 19468 | board_config = ALC662_3ST_2ch_DIG; |
| 19469 | } |
| 19470 | } |
| 19471 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19472 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19473 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19474 | if (err < 0) { |
| 19475 | alc_free(codec); |
| 19476 | return err; |
| 19477 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19478 | } |
| 19479 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19480 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19481 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19482 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19483 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19484 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19485 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19486 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19487 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19488 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19489 | if (!spec->adc_nids) { |
| 19490 | spec->adc_nids = alc662_adc_nids; |
| 19491 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19492 | } |
| 19493 | if (!spec->capsrc_nids) |
| 19494 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19495 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19496 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19497 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19498 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19499 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19500 | switch (codec->vendor_id) { |
| 19501 | case 0x10ec0662: |
| 19502 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19503 | break; |
| 19504 | case 0x10ec0272: |
| 19505 | case 0x10ec0663: |
| 19506 | case 0x10ec0665: |
| 19507 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19508 | break; |
| 19509 | case 0x10ec0273: |
| 19510 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19511 | break; |
| 19512 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19513 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19514 | spec->vmaster_nid = 0x02; |
| 19515 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19516 | codec->patch_ops = alc_patch_ops; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19517 | if (board_config == ALC662_AUTO) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19518 | spec->init_hook = alc662_auto_init; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19519 | alc_pick_fixup_model(codec, alc662_fixup_models, |
| 19520 | alc662_fixup_tbl, alc662_fixups, 0); |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19521 | } |
| 19522 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19523 | alc_init_jacks(codec); |
| 19524 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19525 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19526 | if (!spec->loopback.amplist) |
| 19527 | spec->loopback.amplist = alc662_loopbacks; |
| 19528 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19529 | |
| 19530 | return 0; |
| 19531 | } |
| 19532 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19533 | static int patch_alc888(struct hda_codec *codec) |
| 19534 | { |
| 19535 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19536 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19537 | if (codec->vendor_id == 0x10ec0887) |
| 19538 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19539 | else |
| 19540 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19541 | if (!codec->chip_name) { |
| 19542 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19543 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19544 | } |
| 19545 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19546 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19547 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19548 | } |
| 19549 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19550 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19551 | * ALC680 support |
| 19552 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19553 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19554 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19555 | #define alc680_modes alc260_modes |
| 19556 | |
| 19557 | static hda_nid_t alc680_dac_nids[3] = { |
| 19558 | /* Lout1, Lout2, hp */ |
| 19559 | 0x02, 0x03, 0x04 |
| 19560 | }; |
| 19561 | |
| 19562 | static hda_nid_t alc680_adc_nids[3] = { |
| 19563 | /* ADC0-2 */ |
| 19564 | /* DMIC, MIC, Line-in*/ |
| 19565 | 0x07, 0x08, 0x09 |
| 19566 | }; |
| 19567 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19568 | /* |
| 19569 | * Analog capture ADC cgange |
| 19570 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19571 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19572 | { |
| 19573 | struct alc_spec *spec = codec->spec; |
| 19574 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19575 | int pin_found = 0; |
| 19576 | int type_found = AUTO_PIN_LAST; |
| 19577 | hda_nid_t nid; |
| 19578 | int i; |
| 19579 | |
| 19580 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19581 | nid = cfg->inputs[i].pin; |
| 19582 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19583 | AC_PINCAP_PRES_DETECT)) |
| 19584 | continue; |
| 19585 | if (snd_hda_jack_detect(codec, nid)) { |
| 19586 | if (cfg->inputs[i].type < type_found) { |
| 19587 | type_found = cfg->inputs[i].type; |
| 19588 | pin_found = nid; |
| 19589 | } |
| 19590 | } |
| 19591 | } |
| 19592 | |
| 19593 | nid = 0x07; |
| 19594 | if (pin_found) |
| 19595 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19596 | |
| 19597 | if (nid != spec->cur_adc) |
| 19598 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19599 | spec->cur_adc = nid; |
| 19600 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19601 | spec->cur_adc_format); |
| 19602 | } |
| 19603 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19604 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19605 | struct hda_codec *codec, |
| 19606 | unsigned int stream_tag, |
| 19607 | unsigned int format, |
| 19608 | struct snd_pcm_substream *substream) |
| 19609 | { |
| 19610 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19611 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19612 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19613 | spec->cur_adc_stream_tag = stream_tag; |
| 19614 | spec->cur_adc_format = format; |
| 19615 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19616 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19617 | return 0; |
| 19618 | } |
| 19619 | |
| 19620 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19621 | struct hda_codec *codec, |
| 19622 | struct snd_pcm_substream *substream) |
| 19623 | { |
| 19624 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19625 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19626 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19627 | return 0; |
| 19628 | } |
| 19629 | |
| 19630 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19631 | .substreams = 1, /* can be overridden */ |
| 19632 | .channels_min = 2, |
| 19633 | .channels_max = 2, |
| 19634 | /* NID is set in alc_build_pcms */ |
| 19635 | .ops = { |
| 19636 | .prepare = alc680_capture_pcm_prepare, |
| 19637 | .cleanup = alc680_capture_pcm_cleanup |
| 19638 | }, |
| 19639 | }; |
| 19640 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19641 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19642 | /* output mixer control */ |
| 19643 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19644 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19645 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19646 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19647 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19648 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19649 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19650 | { } |
| 19651 | }; |
| 19652 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19653 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19654 | .ops = &snd_hda_bind_vol, |
| 19655 | .values = { |
| 19656 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19657 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19658 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19659 | 0 |
| 19660 | }, |
| 19661 | }; |
| 19662 | |
| 19663 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19664 | .ops = &snd_hda_bind_sw, |
| 19665 | .values = { |
| 19666 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19667 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19668 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19669 | 0 |
| 19670 | }, |
| 19671 | }; |
| 19672 | |
| 19673 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19674 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19675 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19676 | { } /* end */ |
| 19677 | }; |
| 19678 | |
| 19679 | /* |
| 19680 | * generic initialization of ADC, input mixers and output mixers |
| 19681 | */ |
| 19682 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19683 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19684 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19685 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19686 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19687 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19688 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19689 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19690 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19691 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19692 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19693 | |
| 19694 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19695 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19696 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19697 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19698 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19699 | |
| 19700 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19701 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19702 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19703 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19704 | { } |
| 19705 | }; |
| 19706 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19707 | /* toggle speaker-output according to the hp-jack state */ |
| 19708 | static void alc680_base_setup(struct hda_codec *codec) |
| 19709 | { |
| 19710 | struct alc_spec *spec = codec->spec; |
| 19711 | |
| 19712 | spec->autocfg.hp_pins[0] = 0x16; |
| 19713 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19714 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19715 | spec->autocfg.num_inputs = 2; |
| 19716 | spec->autocfg.inputs[0].pin = 0x18; |
| 19717 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19718 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19719 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19720 | } |
| 19721 | |
| 19722 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19723 | unsigned int res) |
| 19724 | { |
| 19725 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19726 | alc_automute_amp(codec); |
| 19727 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19728 | alc680_rec_autoswitch(codec); |
| 19729 | } |
| 19730 | |
| 19731 | static void alc680_inithook(struct hda_codec *codec) |
| 19732 | { |
| 19733 | alc_automute_amp(codec); |
| 19734 | alc680_rec_autoswitch(codec); |
| 19735 | } |
| 19736 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19737 | /* create input playback/capture controls for the given pin */ |
| 19738 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19739 | const char *ctlname, int idx) |
| 19740 | { |
| 19741 | hda_nid_t dac; |
| 19742 | int err; |
| 19743 | |
| 19744 | switch (nid) { |
| 19745 | case 0x14: |
| 19746 | dac = 0x02; |
| 19747 | break; |
| 19748 | case 0x15: |
| 19749 | dac = 0x03; |
| 19750 | break; |
| 19751 | case 0x16: |
| 19752 | dac = 0x04; |
| 19753 | break; |
| 19754 | default: |
| 19755 | return 0; |
| 19756 | } |
| 19757 | if (spec->multiout.dac_nids[0] != dac && |
| 19758 | spec->multiout.dac_nids[1] != dac) { |
| 19759 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19760 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19761 | HDA_OUTPUT)); |
| 19762 | if (err < 0) |
| 19763 | return err; |
| 19764 | |
| 19765 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19766 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19767 | |
| 19768 | if (err < 0) |
| 19769 | return err; |
| 19770 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19771 | } |
| 19772 | |
| 19773 | return 0; |
| 19774 | } |
| 19775 | |
| 19776 | /* add playback controls from the parsed DAC table */ |
| 19777 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19778 | const struct auto_pin_cfg *cfg) |
| 19779 | { |
| 19780 | hda_nid_t nid; |
| 19781 | int err; |
| 19782 | |
| 19783 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19784 | |
| 19785 | nid = cfg->line_out_pins[0]; |
| 19786 | if (nid) { |
| 19787 | const char *name; |
| 19788 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19789 | name = "Speaker"; |
| 19790 | else |
| 19791 | name = "Front"; |
| 19792 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19793 | if (err < 0) |
| 19794 | return err; |
| 19795 | } |
| 19796 | |
| 19797 | nid = cfg->speaker_pins[0]; |
| 19798 | if (nid) { |
| 19799 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19800 | if (err < 0) |
| 19801 | return err; |
| 19802 | } |
| 19803 | nid = cfg->hp_pins[0]; |
| 19804 | if (nid) { |
| 19805 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19806 | if (err < 0) |
| 19807 | return err; |
| 19808 | } |
| 19809 | |
| 19810 | return 0; |
| 19811 | } |
| 19812 | |
| 19813 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19814 | hda_nid_t nid, int pin_type) |
| 19815 | { |
| 19816 | alc_set_pin_output(codec, nid, pin_type); |
| 19817 | } |
| 19818 | |
| 19819 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19820 | { |
| 19821 | struct alc_spec *spec = codec->spec; |
| 19822 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19823 | if (nid) { |
| 19824 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19825 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19826 | } |
| 19827 | } |
| 19828 | |
| 19829 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19830 | { |
| 19831 | struct alc_spec *spec = codec->spec; |
| 19832 | hda_nid_t pin; |
| 19833 | |
| 19834 | pin = spec->autocfg.hp_pins[0]; |
| 19835 | if (pin) |
| 19836 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19837 | pin = spec->autocfg.speaker_pins[0]; |
| 19838 | if (pin) |
| 19839 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19840 | } |
| 19841 | |
| 19842 | /* pcm configuration: identical with ALC880 */ |
| 19843 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19844 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19845 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19846 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19847 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19848 | |
| 19849 | /* |
| 19850 | * BIOS auto configuration |
| 19851 | */ |
| 19852 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19853 | { |
| 19854 | struct alc_spec *spec = codec->spec; |
| 19855 | int err; |
| 19856 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19857 | |
| 19858 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19859 | alc680_ignore); |
| 19860 | if (err < 0) |
| 19861 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19862 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19863 | if (!spec->autocfg.line_outs) { |
| 19864 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19865 | spec->multiout.max_channels = 2; |
| 19866 | spec->no_analog = 1; |
| 19867 | goto dig_only; |
| 19868 | } |
| 19869 | return 0; /* can't find valid BIOS pin config */ |
| 19870 | } |
| 19871 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19872 | if (err < 0) |
| 19873 | return err; |
| 19874 | |
| 19875 | spec->multiout.max_channels = 2; |
| 19876 | |
| 19877 | dig_only: |
| 19878 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19879 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19880 | if (spec->kctls.list) |
| 19881 | add_mixer(spec, spec->kctls.list); |
| 19882 | |
| 19883 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19884 | |
| 19885 | err = alc_auto_add_mic_boost(codec); |
| 19886 | if (err < 0) |
| 19887 | return err; |
| 19888 | |
| 19889 | return 1; |
| 19890 | } |
| 19891 | |
| 19892 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19893 | |
| 19894 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19895 | static void alc680_auto_init(struct hda_codec *codec) |
| 19896 | { |
| 19897 | struct alc_spec *spec = codec->spec; |
| 19898 | alc680_auto_init_multi_out(codec); |
| 19899 | alc680_auto_init_hp_out(codec); |
| 19900 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19901 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19902 | if (spec->unsol_event) |
| 19903 | alc_inithook(codec); |
| 19904 | } |
| 19905 | |
| 19906 | /* |
| 19907 | * configuration and preset |
| 19908 | */ |
| 19909 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19910 | [ALC680_BASE] = "base", |
| 19911 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19912 | }; |
| 19913 | |
| 19914 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19915 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19916 | {} |
| 19917 | }; |
| 19918 | |
| 19919 | static struct alc_config_preset alc680_presets[] = { |
| 19920 | [ALC680_BASE] = { |
| 19921 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19922 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19923 | .init_verbs = { alc680_init_verbs }, |
| 19924 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19925 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19926 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19927 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19928 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19929 | .unsol_event = alc680_unsol_event, |
| 19930 | .setup = alc680_base_setup, |
| 19931 | .init_hook = alc680_inithook, |
| 19932 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19933 | }, |
| 19934 | }; |
| 19935 | |
| 19936 | static int patch_alc680(struct hda_codec *codec) |
| 19937 | { |
| 19938 | struct alc_spec *spec; |
| 19939 | int board_config; |
| 19940 | int err; |
| 19941 | |
| 19942 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19943 | if (spec == NULL) |
| 19944 | return -ENOMEM; |
| 19945 | |
| 19946 | codec->spec = spec; |
| 19947 | |
| 19948 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19949 | alc680_models, |
| 19950 | alc680_cfg_tbl); |
| 19951 | |
| 19952 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19953 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19954 | codec->chip_name); |
| 19955 | board_config = ALC680_AUTO; |
| 19956 | } |
| 19957 | |
| 19958 | if (board_config == ALC680_AUTO) { |
| 19959 | /* automatic parse from the BIOS config */ |
| 19960 | err = alc680_parse_auto_config(codec); |
| 19961 | if (err < 0) { |
| 19962 | alc_free(codec); |
| 19963 | return err; |
| 19964 | } else if (!err) { |
| 19965 | printk(KERN_INFO |
| 19966 | "hda_codec: Cannot set up configuration " |
| 19967 | "from BIOS. Using base mode...\n"); |
| 19968 | board_config = ALC680_BASE; |
| 19969 | } |
| 19970 | } |
| 19971 | |
| 19972 | if (board_config != ALC680_AUTO) |
| 19973 | setup_preset(codec, &alc680_presets[board_config]); |
| 19974 | |
| 19975 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19976 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19977 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19978 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19979 | |
| 19980 | if (!spec->adc_nids) { |
| 19981 | spec->adc_nids = alc680_adc_nids; |
| 19982 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19983 | } |
| 19984 | |
| 19985 | if (!spec->cap_mixer) |
| 19986 | set_capture_mixer(codec); |
| 19987 | |
| 19988 | spec->vmaster_nid = 0x02; |
| 19989 | |
| 19990 | codec->patch_ops = alc_patch_ops; |
| 19991 | if (board_config == ALC680_AUTO) |
| 19992 | spec->init_hook = alc680_auto_init; |
| 19993 | |
| 19994 | return 0; |
| 19995 | } |
| 19996 | |
| 19997 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19998 | * patch entries |
| 19999 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20000 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20001 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20002 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20003 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 20004 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20005 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20006 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 20007 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20008 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20009 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20010 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20011 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 20012 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 20013 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20014 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20015 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20016 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 20017 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 20018 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 20019 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 20020 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20021 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20022 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20023 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20024 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 20025 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20026 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 20027 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20028 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20029 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 20030 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 20031 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20032 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20033 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20034 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20035 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20036 | {} /* terminator */ |
| 20037 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20038 | |
| 20039 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 20040 | |
| 20041 | MODULE_LICENSE("GPL"); |
| 20042 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 20043 | |
| 20044 | static struct hda_codec_preset_list realtek_list = { |
| 20045 | .preset = snd_hda_preset_realtek, |
| 20046 | .owner = THIS_MODULE, |
| 20047 | }; |
| 20048 | |
| 20049 | static int __init patch_realtek_init(void) |
| 20050 | { |
| 20051 | return snd_hda_add_codec_preset(&realtek_list); |
| 20052 | } |
| 20053 | |
| 20054 | static void __exit patch_realtek_exit(void) |
| 20055 | { |
| 20056 | snd_hda_delete_codec_preset(&realtek_list); |
| 20057 | } |
| 20058 | |
| 20059 | module_init(patch_realtek_init) |
| 20060 | module_exit(patch_realtek_exit) |